iif statement

G

geebee

hi,

I have the following:

SELECT "all resolved" AS ResolvedStatus,
[1calltotals2Rjuly130_final].ResolvedDt, [1calltotals2Rjuly130_final].Expr1,
"line5" AS line
FROM 1calltotals2Rjuly130_final
GROUP BY "all resolved", [1calltotals2Rjuly130_final].ResolvedDt,
[1calltotals2Rjuly130_final].Expr1;


I would like to make the query depend on whether or not there is a value
entered in a form. For example, if the form's field is null, then use the
above. If it is not null, then use another table. I tried to change the
query to:

iif(forms![test]![field1] <>"",SELECT "all resolved" AS ResolvedStatus,
[1calltotals2Rjuly130_final].ResolvedDt, [1calltotals2Rjuly130_final].Expr1,
"line5" AS line
FROM 1calltotals2Rjuly130_final
GROUP BY "all resolved", [1calltotals2Rjuly130_final].ResolvedDt,
[1calltotals2Rjuly130_final].Expr1;, SELECT ResolvedStatus,
[1calltotals2Rjuly130_finaltemp].ResolvedDt,
[1calltotals2Rjuly130_finaltemp].Expr1, "line5" AS line
FROM 1calltotals2Rjuly130_finaltemp
GROUP BY "all resolved", [1calltotals2Rjuly130_finaltemp].ResolvedDt,
[1calltotals2Rjuly130_finaltemp].Expr1; ))

But I am having no luck. Could someone please help?

Thanks in advance,
geebee
 

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

change underlying query 2
create query dynamically 1
query prompts 2
show count 4
UNION QUERY 1
format number 1
data type mismatch in criteria expression 2
graph 0

Top