syntax error (comma) in query expression (1 Viewer)

golferbabe38

Registered User.
Local time
Today, 11:10
Joined
Sep 17, 2007
Messages
19
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

Smeghead
Local time
Today, 11:10
Joined
Jan 12, 2001
Messages
32,059
IIf(DateDiff("yyyy",[Date of Next Medical License Renewal],[Date of Last Domestic Violence Credit (2)])>6,"yes","no")
 

golferbabe38

Registered User.
Local time
Today, 11:10
Joined
Sep 17, 2007
Messages
19
Thank you so much! I had to reverse the fields for it to calculate, but it works! Thank you and have a great day! :)
 

Users who are viewing this thread

Top Bottom