Microsoft OfficeMicrosoft AccessMicrosoft ApplicationsSQL
Last Comment
adgram1
8/22/2022 - Mon
PatHartman
Are you sure mydatefield is actually defined as date? It may look like a date to a human but if the data type isn't a date data type then Access will do a string compare.
adgram1
ASKER
Yes , the data type is defined as date
aikimark
Is the source table resident within your MS Access database or is this an attached table?
What is your regional setting for datetime formats?
When you write "don't work", exactly what do you mean?
I mean that access dont accepts the function , the regional setting is GREEK , 8/1/2016
PatHartman
adgram, It is still not clear exactly what problem you are experiencing. The IIF() should work as written unless there is some subtle syntax error that we are missing. Are you getting an error message or are you getting invalid results?
Dates are tricky in that in some instances you must use the mm/dd/yyyy format whenever the interpretation can be ambigous. Is 1/2/16 Jan 2nd or Feb 1st? In Greece, do you use the dd/mm/yyyy format for dates? If so, whenever you create a string expression (which #1/1/2016# is), you need to use the mm/dd/yyyy format. Of course to avoid confusion for yourself, you could use yyyy/mm/dd instead.
adgram1
ASKER
I will try to exlain , when I write =[myfielddate] it is ok
when I write =IIf([myfielddate]>#2015/01/01#, "yes", "no") or 1/1/2015 or 01/01/2015 it says not valid syntax
I think that the problem is in regional setings, Gustav Brock gave me the idea forsemicolons and also aikimark gave me the idea to find the solution working with sql code. Thanks all