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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Conditions on a form

Status
Not open for further replies.

BSC5905

Technical User
Apr 30, 2004
20
US
I have a table that has three date fields. They are:
CR_SubmittedDate
CR_RoutingDate
CR_ApprovalDate

I need assure that when the dates are entered in a text box on a form they meet the following condition:

The “CR_SubmittedDate” must be less than or equal to the “CR_RoutingDate”, and the “CR_RoutingDate” must be less than or equal to the “CR_ApprovalDate”

Maybe this is a better way to see it:
CR_SubmittedDate <= CR_RoutingDate <= CR_ApprovalDate

Can this be done and if so how?

One other thing I forgot to mention is that on the “General Tab” in table design view “Required” is set to “No” because I will not have the data for every record.


Thank you for any assistance.
 
How are ya BSC5905 . . .

In the code module of th form, copy/paste the following function:
Code:
[blue]Public Function DatesOK() As Boolean
   If IsDate(Me!CR_SubmittedDate) And _
      IsDate(Me!CR_RoutingDate) And _
      IsDate(Me!CR_ApprovalDate) Then
      
      If (Me!CR_SubmittedDate <= Me!CR_RoutingDate) And _
         (Me!CR_RoutingDate <= Me!CR_ApprovalDate) Then DatesOK = True
   End If
   
End Function[/blue]
[blue]The function returns true if dates exist and conditions are true . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top