I have 2 date-fields : ReportDate and ShipDate
On the same record (Form), ReportDate is entered first, and then the ShipDate.
If the ShipDate is entered greater than the ReportDate, I want a warning msg pops up and block the entry, i.e. the ShipDate should always be lower than the ReportDate.
Please help.
thanks
Karen
Block a date entry
-
- 3StarLounger
- Posts: 212
- Joined: 28 Mar 2011, 18:29
- Location: Netherlands
-
- Administrator
- Posts: 78524
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Block a date entry
Create a Before Update event procedure for the ShipDate text box:
Code: Select all
Private Sub ShipDate_BeforeUpdate(Cancel As Integer)
If Not IsNull(Me.ReportDate) And Not IsNull(Me.ShipDate) Then
If Me.ShipDate > Me.ReportDate Then
MsgBox "Ship Date cannot be later than Report Date!", vbExclamation
Cancel = True
End If
End If
End Sub
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 212
- Joined: 28 Mar 2011, 18:29
- Location: Netherlands
Re: Block a date entry
Thanks very much for the prompt response!
Works perfect!
Karen
Works perfect!
Karen