IIF Statement getting error message...what's wrong?

G

Guest

I want to create a new field (DBE/SBE Goal) in a query based on information
in existing fields (DBE % & SBE %).

How do I write the expression to get the following result: If there is a
figure in the DBE % field, give me that figure followed by "% DBE" and/or if
there is a figure in the SBE% field, give me that figure followed by "% SBE".
In short, if both fields have data, give me both, otherwise give me what's
in either field, if both are empty, give me "None set".

I've tried this expression:
IIf(Len([DBE %] & "") > 0, IIf(Len([SBE %] & "")>0, [DBE %] & " %DBE, " &
[SBE %] & " % SBE", [DBE %] & " %DBE"), [SBE %] & " % SBE", "None set')

I keep getting a error message. Please advise.
 
D

Douglas J. Steele

Already answered. These newsgroups are manned by unpayed volunteers.
Sometimes it takes a little time to get an answer.
 
G

Guest

Thanks Douglas...sorry for my impatience. I thought the individuals
answering the query-specific questions, had greater expertise in querying,
that's why I posed the question here as well.
--
Thanks, Karen


Douglas J. Steele said:
Already answered. These newsgroups are manned by unpayed volunteers.
Sometimes it takes a little time to get an answer.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Karen said:
I want to create a new field (DBE/SBE Goal) in a query based on information
in existing fields (DBE % & SBE %).

How do I write the expression to get the following result: If there is a
figure in the DBE % field, give me that figure followed by "% DBE" and/or
if
there is a figure in the SBE% field, give me that figure followed by "%
SBE".
In short, if both fields have data, give me both, otherwise give me what's
in either field, if both are empty, give me "None set".

I've tried this expression:
IIf(Len([DBE %] & "") > 0, IIf(Len([SBE %] & "")>0, [DBE %] & " %DBE, " &
[SBE %] & " % SBE", [DBE %] & " %DBE"), [SBE %] & " % SBE", "None set')

I keep getting a error message. Please advise.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top