Originally Posted by
fadone
My application have been developed using MS Access forms with come VB code behind it...In one of the forms, I have two date fields,say,Date A and Date B.At any one given time,Date B must be greater than Date A,otherwise an error message(customized) should pop up requesting a valid input.This error should be envoked once the Date B field loose the focus......hence no more focus to other fields unless and until the valid date has been entered!!!!
I have tried it using Validation Rule property at table and form level but it didnt work out properly...
Any idea?
I the form's BeforeUpdate event sub, add something like this:
Code:
If Me!DateA >= Me!DateB Then
MsgBox "DateB must be greater than DateA", vbCritical, "Invalid Entry"
Cancel = True
Me.DateA.SetFocus
End If