Date Check (1 Viewer)

Kundan

Registered User.
Local time
Today, 08:17
Joined
Mar 23, 2019
Messages
118
In the attached DB I am entering dates in the pop up form. If date is less than today it asks whether date is correct. If I say NO I want cursor to remain in the DT field. For this I have written a code Me.DT.SetFocus. But it is not happening. Please guide me.
 

Attachments

  • Database1.zip
    77.4 KB · Views: 55

bob fitz

AWF VIP
Local time
Today, 15:17
Joined
May 23, 2011
Messages
4,717
Your validation code needs to be in the Before Update event of the form or the control that you are editing. Try the following code in the BeforeUpdate event of the control called DT:

Code:
If (Me.DT < Date Or Me.DT >= (Date + 30)) Then
    If MsgBox("Are you sure DATE is correct?", vbDefaultButton2 + vbYesNo + vbQuestion) = vbNo Then
    Cancel = True
    End If
End If
 

Users who are viewing this thread

Top Bottom