View Full Version : syntax error (comma) in query expression


golferbabe38
09-17-2007, 12:05 PM
Hello, first time posting, not sure what info you all need. I'm looking for some help with an if/then statement in access query involving dates. Below is the query I am trying to use, along with the error message. Any ideas?

Domestic Violence CME Required?: IIf(([Date of Next Medical License Renewal]-[Date of Last Domestic Violence Credit (2)])>("yyyy",6),"yes","no")

syntax error (comma) in query expression 'IIf(([Date of Next Medical License Renewal]-[Date of Last Domestic Violence Credit (2)])>("yyyy",6),"yes","no")'

The error seems to be in relationship to the number 6. I want a "yes" to show up in the field if the difference is greater then 6 years.

boblarson
09-17-2007, 12:09 PM
IIf(DateDiff("yyyy",[Date of Next Medical License Renewal],[Date of Last Domestic Violence Credit (2)])>6,"yes","no")

golferbabe38
09-17-2007, 12:20 PM
Thank you so much! I had to reverse the fields for it to calculate, but it works! Thank you and have a great day! :)