date less then another date

dark11984

Registered User.
Local time
Tomorrow, 08:16
Joined
Mar 3, 2008
Messages
129
I'm trying to do a dcount if my date field is on or before today.

The date in [reminderdate] is 01/07/10. So i'm not sure why it isn't counting it.

if i change the date to 01/07/09 it works. i'm thing it is counting the date as a number? do i need to declare [reminderdate] as a date?

Code:
If DCount("[reminderdate]", "tbltasks", "[completed]<>-1 and [reminderDate]<= #" & Date & "#") > 0 Then
    If MsgBox("You have tasks to be completed." & Chr(13) & Chr(13) & "Would you like to print a tasks list?", vbYesNo,) = vbYes Then
        DoCmd.OpenReport "RptTasks", acNormal
    End If
End If
 
You have to pass the date in US or ISO format, if your settings are otherwize it might break in interperting your date as 07 Jan instead of 01 Jul

Try:
Code:
If DCount("[reminderdate]", "tbltasks", "[completed]<>-1 and [reminderDate]<= #" & Format(Date, "MM/DD/YYYY") & "#") > 0 Then
 

Users who are viewing this thread

Back
Top Bottom