Basic Syntax Problem

C

Co9ug9ar

Can anyone please tell me what is wrong the following syntax in an unbound
text box inside a report or suggest a better method?

iif([Forms![Date Input Form]![Desired Date],"Forms![Date Input
Form]![Desired Date], "Forms![Date Input Form]![Begin Date] & ' until ' &
Forms![Date Input Form]![End Date]")

I get an error that says
"Syntaz error (missing operator) in query expression
'First([iif[Forms]![Date Input Form]![[Desired Date],"Forms]![Date Input
Form![[Desired Date], "Forms]![Date Input Form]![[Begin Date] & ' until ' &
Forms]![Date Input Form]![[End Date]")])'

Basically all I want it to do is either print out a single date, if
available, or just a string concatinating 2 dates and the word 'until'
between them. Is there an easier way to do this than what I'm doing?

Thanks,
Keith
 
L

Lynn Trapp

The first argument in an IIF statement has to be an expression. Try changing
it to this:

iif([Forms![Date Input Form]![Desired Date] Is Not Null,Forms![Date Input
Form]![Desired Date], Forms![Date Input Form]![Begin Date] & " until " &
Forms![Date Input Form]![End Date])
 
C

Co9ug9ar

Adding the "Is Not Null" got rid of the syntax error, but now I just get a
#name. I thought it might need quotations around the if-true and if-false
statements, but I'm apperently not getting the right combinations, especially
with the trying to add in the 'until' part. Any ideas?
 
Top