G
Guest
I want to say;
"Invalid date: Enter a date later than " [DateFrom]
thanks
"Invalid date: Enter a date later than " [DateFrom]
thanks
-----Original Message-----
I want to say;
"Invalid date: Enter a date later than " [DateFrom]
Allen Browne said:Nick, are you doing this in the table, or in the form?
Table context
==========
You do not know whether the user will enter the From date before the To
date, so you need to use the Validation Rule of the table (not that of the
field).
1. Open your table in Design view.
2. Open the Properties box (View menu).
3. Enter this beside the table's validation rule (the one in the Properties
box, not the one in the lower pane of table design, which is the rule for
the field):
([FromDate] Is Null) OR ([ToDate] Is Null) OR ([FromDate] <=
[ToDate])
4. For the Validation Text, just use:
'To Date' cannot be before 'From Date'.
Form context
==========
In the context of a form, use the form's BeforeUpdate event to perform the
comparision:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.ToDate < Me.FromDate Then
Cancel = True
MsgBox "Enter a date later than " & Me.[DateFrom]
Me.ToDate.SetFocus
End If
End Sub
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Nick in Tokyo said:I want to say;
"Invalid date: Enter a date later than " [DateFrom]
thanks