Edit Run-time Error

velcrowe

Registered User.
Local time
Yesterday, 21:51
Joined
Apr 26, 2006
Messages
86
I have the following code that I am using to enter an date created and date closed for a record. I am using the vbCalendar pop-up to enter in the date closed date...

Private Sub dtmdateclosed_Click()
calend2.Visible = True
calend2.SetFocus

If dtmdateclosed < dtmdatecreated Then
MsgBox "The Date Closed must be greater than the Date Created. ", vbCritical
calend2.Visible = True
calend2.SetFocus

Exit Sub
End If
End Sub

When I click on the same date twice I get the following run-time error #2110
"Microsoft Office Can't Move the focus to the control calend2."

How can replace this run-time error to say that "you've clicked the same day again. please choose a new date"

or to ignore the run-time error and to see the message box text displayed above.

Thank you in advance for all your help:eek: :eek:
 

Users who are viewing this thread

Back
Top Bottom