Sorry JBB, it's been a while I touched Access VBA but I think I had a problem similar to yours a while back and concluded that it was a problem with domain aggregate functions. It would appear that these functions interpret dates using their own pre-defined locale settings.
Your Dlookup appears to work fine here on the Yankee side, so it looks like you guys are right in that it must be something with how the domain functions interpret the locale settings for dates.
Your Dlookup appears to work fine here on the Yankee side, so it looks like you guys are right in that it must be something with how the domain functions interpret the locale settings for dates.
Thanks Beetle. So the code I posted in Post #1 works straight up on the US set up? In which case I think the vbaInet's code in post #20 should be put in a handy location for future reference.
English (Australia)
DupDate = #1/03/2012# 01-Mar-12
English (United States)
DupDate = #3/1/2012# 01-Mar-12
French (Switzerland)
DupDate = #01.03.2012# 01-mars-12 This crashes on the period
Notes:
1.
Formatting the Controls as Medium Date returns a 4 digit year.
Using Format(Me.RecDate, "Medium Date") only returns a 2 digit year.
2.
In all cases it is in Day Month Year format irrespective of regional settings. So, in the US where dates default to Month Day Year the Medium Date format still returns Day Month Year.
3.
The selection of the date format in the combo box list is sensitive to the words and date separator, as set in regional settings, but the Medium Date format is not sensitive to the General Date D/M/Y distribution in regional settings. It appears that it is either set by Access or Windows but I don’t know where.
i am trying to use a dlookup function that seacrhes for a record with todays date..
eg:
Dim today As Date
today = Format(Now(), "mm / dd / yyyy")
If (Nz(DLookup("Incoming Customer", "EnquiryManagement", "datevalue(TodaysDate)= " & DateValue(Me.date) & " "))) > 0 Then
Else
End If