Evaluate Open and Closed Dates

velcrowe

Registered User.
Local time
Today, 16:19
Joined
Apr 26, 2006
Messages
86
I have two date fields that I am using a form to show the open and close date of an investigation. The opened date field is controlled by a textbox elsewhere on the form, but the date closed is controlled by the vbCalendar control. What I am trying to do in coding is to evaluate whether or not the closed date is before the open date. If the date closed is before the date open I would like a message box to open that prevents the user from moving forward and reminding them that the date closed is earlier than the date open. Is it possible with the vbCalendar option being able to change its focus continually.
 
This should do what you want.

MyCal is the name of the Calendar control.

Code:
Private Sub MyCal_Click()
    If Me.MyCal.Value < Me.StartDate Then
        MsgBox " The End Date is before the Start Date"
    Else
        Me.txtEndDate = Me.MyCal.Value
    End If
End Sub


PS You should delete you duplicate posts.
 

Users who are viewing this thread

Back
Top Bottom