Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to validate start date is less than end date on a form

Status
Not open for further replies.

PeanutB7

Programmer
Joined
Jun 13, 2005
Messages
56
Location
US
Hi folks,

I have a form presently that includes a start date and end date for projects. These dates are saved to a table and are critical in calculations of hours per day for project time analysis. The data input folks are regretfully reversing end dates with start dates and ending up with negative numbers in my date calculations that occur downstream. Is there a validation rule that would restrict the input to be start date is equal to or less than end date. I have tried the simple '=[end date]>[start date]' as a validation rule in the end date cell of the form and it is not accepting any inputs even when they are correct. PLEASE HELP

Thank You in advance

JB
 
In the BeforeUpdate event procedure of the Form:
If Not(IsDate([start date]) And IsDate([end date]) And [start date] < [end date]) Then
MsgBox "Check the dates please"
Cancel = True
[start date].SetFocus
Exit Sub
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top