Hi, I´m using DCOUNT to find the number of records in a qry....
this is the LINE:
ChkClash = DCount("[IdTurno]", "qry_Turnos", "[HoraInicio] = #" & HoraInicial & "# AND [Fecha] = #" & DateNumber & "# AND [IdMedico] =" & MD)
the strange thing is that it works only with dates >= 15 of each month.
It means that 15/10/2002 will return records but 13/10/2002 will not.
I can´t find the diff in the logic of dates
Thanks in advance
The Jet DB engine's default date format is mm/dd/yyyy only if that doesn't apply it will try if other formats could be applicable. So if you have 01/02/2003 it will interprete that as the 2nd of January 2003. 13/02/2003 will however be interpreted as the 13th of February 2003 (as there's no month after December ).
You should avoid handling dates in string format. The format function obeys regional settings and the output will differ from locale settings.
Use the date data type within vba and when passing to queries (or the domain functions) convert it to double first. Jet internally handles dates as double format (where 1 is one day). There's also a nasty part with double though, you need to watch out for the decimal point character if it's ',' or anything and not the '.' in your locale as Jet only accepts the '.'. The CStr function obeys regional settings as well, so use the Str function instread.
Your dlookup would look something like this:
dim MyDate as Date
Dlookup("[SomeDate]","TblMyTable","SomeDate=" & Str(CDbl(MyDate)))