Form validation - yes that old chestnut

tezread

Registered User.
Local time
Today, 22:34
Joined
Jan 26, 2010
Messages
330
I have two date/time fields.

Date referred
Date seen

I want to add some validation in it which says If the Date referred entered is greater than the date seen - tell the user to "Date referred cannot be entered as a date greater than the date seen"
 
You could use some code along the lines of the following in the Date Seen field's Before Update event;
Code:
    If Me.SeenField <= Me.RefField Then
        MsgBox "Seen must be after than Referred"
        Cancel = True
    End If
 
Something like this in the date referred textbox's after update event should do it (replace my control names with yours):

Code:
If txtDateReferred > txtDateSeen Then
   msgbox "Date referred cannot be entered as a date greater than the date seen"
End If

:edit:

I forgot to include setting the field back to null, but JBB's before update & cancel is better than after update & setting back to null.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom