Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF AND IF Function Question

Status
Not open for further replies.

backer

Technical User
Apr 13, 2001
24
US
I need an IF statement that I can use in a Query that will provide an "OVERDUE" if both of two conditions are met. I thought there was a way that you can combine two IF statements to do this. When I enter the below in my Query, I get an error "Undefined function 'IF' in expression". Could someone please tell me how to make this work.

S: IF([DateRecd] Is Null And IF([DaysHeld]>[MaxDays],"OVERDUE",""))
 
Try

IIf (IsNull([DateRecd]) And ([DaysHeld]>[MaxDays]),"Overdue","") There are two ways to write error-free programs; only the third one works.
 
The line should read:

IIF(IsNull([DateRecd]) And IF([DaysHeld]>[MaxDays],"OVERDUE","")) If we knew what it was we were doing, it would not be called research, would it? - Albert Einstein [atom]

Robert L. Johnson III, A+, Network+, MCP
Access Developer/Programmer
robert.l.johnson.iii@citigroup.com
 
IIF(IsNull([DateRecd])
,IIF([DaysHeld]>[MaxDays],"OVERDUE","")
,"")

rudy
 
Thanks a lot. I tried the first solution and it worked well, so I didn't need to try the others. Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top