Future Date input (1 Viewer)

racdata

Registered User.
Local time
Today, 14:08
Joined
Oct 30, 2002
Messages
74
Hi,
I want to force the users to plan their work at least one day in advance. I need to know how to enter a plan date that is one day in advance. If you do planning today you can only enter a date from tomorrow onwards.

Access must not allow you to enter a date earlier than tomorrow.

Can anybody help please?

Thanks
 

Estuardo

Registered User.
Local time
Today, 12:08
Joined
May 27, 2003
Messages
134
G'd Afternoon,
Use almost any date function to compare the current date with user's date
something like this
Code:
Private Sub txtWorkDate_BeforeUpdate(Cancel As Integer)
On Error GoTo ExceptionHandler
  
    If VBA.DateDiff("d", VBA.Now, VBA.CDate(Me.txtWorkDate)) <= 0 Then
        MsgBox "Just dates ahead please"
        Cancel = True
        Me.txtWorkDate.Undo
    End If

ExitHere:
Exit Sub
ExceptionHandler:
MsgBox "Exception ID " & Err.Number & VBA.vbCrLf & Err.Description & VBA.vbCrLf & "Module: Form_frmPlanning" & VBA.vbCrLf & "Procedure: txtWorkDate_BeforeUpdate of "
Resume ExitHere    
End Sub
 

Users who are viewing this thread

Top Bottom