Comparing a Date/Time field to system date

mikeco555

Registered User.
Local time
Today, 14:20
Joined
Jan 23, 2004
Messages
22
Hi,

I am trying to compare a value in my databse produced by the date() function, short date format, to one that is exactly 24 hours after the value recorded by the date() function. If the value in the database is 24 hours prior to the current date(), I need to flag a text box a diffrent color to alert the user. I am unsure on the If statement that I will need to produce this result.

Any help would be greatly appreciated!!!!
Thanks
Mikeco555
 
i think what you want is to change background colour of a textbox so this will make the text box red if the date field is more than 24 hours past...

If Date()-1 > [YourDateField] Then
Text10.BackColor = vbRed
Else
Text10.BackColor = vbWhite
End If

put it both in form On Current event and textbox AfterUpdate event so it changes as the update is done
 
I don't think your "Date function" is going to work for tracking exact hours. Look into the Now() function. Your short date format is not giving you hours... which you are trying to measure.
 
I think that logic will work but I have one more issue, the text box that I need changed to a red background is part of a form that is bound to a query. So there may be multiple records with diffrent dates. I need to flag specific records that meet the criteria but not the ones that don't.

Thank you very much for all your help
 

Users who are viewing this thread

Back
Top Bottom