Help with date field

M0E-lnx

Registered User.
Local time
Today, 16:43
Joined
Sep 3, 2008
Messages
62
I have a field in a form that I need help with. I want to set a default value for it depending on the time of the day the record is being entered.

If the current time is 11:00 am or earlier, I want it to default to today
otherwise, I want it to default to tomorrow's date

any suggestions?
 
Code:
Private Sub Form_Current()
 If Me.NewRecord Then
   If Time > #11:00:00 AM# Then
     Me.YourField = Date + 1
   Else
     Me.YourField = Date 
   End If
 End If
End Sub
Date + 1 works fine for tomorrow’s date, but for the fussbudgets out there
Code:
Private Sub Form_Current()
 If Me.NewRecord Then
   If Time > #11:00:00 AM# Then
     Me.YourField = DateAdd(“d”, 1,  Date)
   Else
     Me.YourField = Date
   End If
 End If
End Sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom