Calender Control error

jax

Registered User.
Local time
Today, 08:23
Joined
Mar 4, 2002
Messages
61
I have an activex calender control opening to make entering dates easier for users. The calender opens onclick in the text box. The date is selected and is entered in the field but i get the following error message "run time error 2165, you can't hide a control that has the focus".

The code I entered is:

Private Sub Calendar_Click()
ADate.Value = Calendar.Value
Calendar.Visible = False
ADate.SetFocus
End Sub

Private Sub ADate_Enter()
'Show Calendar and set its date.
Calendar.Visible = True
Calendar.SetFocus

End Sub

can anyone tell me where I am going wrong?
 
Just for information I solved the problem by changing the setfocus to another field and then making the calendar invisible:

Private Sub Calendar_Click()
ADate.Value = Calendar.Value
Calendar.Visible = True
BDate.SetFocus
Calendar.Visible = False
End Sub

Hope this helps someone else having the same problem.
 

Users who are viewing this thread

Back
Top Bottom