stress999,
Much like in your other thread, the general code will be the same. But, if you want to prevent the user from moving on, just add code that disables any controls that would allow them to move along.
Assuming that the user enters Date1, then enters Date2, then they click a "Search" button, for example, just disable the Search Button if the dates don't meet the criteria:
- Option Explicit
-
-
Private Sub txtDate1_AfterUpdate()
-
VerifyDates
-
End Sub
-
Private Sub txtDate2_AfterUpdate()
-
VerifyDates
-
End Sub
-
Private Sub VerifyDates()
-
If Not (IsNull(Me.txtDate1) Or IsNull(Me.txtDate2)) Then
-
If Me.txtDate2 < Me.txtDate1 Then
-
Me.txtWarning = "Date 2 must be after Date 1"
-
Me.cmdSearch.Enabled = False
-
Else
-
Me.txtWarning = ""
-
Me.cmdSearch.Enabled = True
-
End If
-
End If
-
End Sub
Hope this hepps!