Macro Conditions

GGrieve

New member
Local time
Yesterday, 23:42
Joined
Oct 10, 2008
Messages
5
I am looking to have a pop up message on the opening of a form if a field end_date = Todays Date but no matter how i try it will not check field and find todays date. Message box working without condition, Can anyone out there please inform me of correct code for this to work. Many Thanks
 
There's a good chance it is taking time into account too, although displays as a date.

Try using DateValue(yourdatefield)
 
I'd use the DateDiff function - add the following code into your form open event, where txtDate is the name of the textbox containing the date you're checking against:

If DateDiff("d", Me.txtDate, Now()) = 0 Then
MsgBox "Dates are the same", vbInformation, "Same date"
End If
 

Users who are viewing this thread

Back
Top Bottom