Calendar Control

Purdue22

Registered User.
Local time
Today, 01:46
Joined
May 11, 2001
Messages
25
I am having trouble getting code to work for a calendar. When I click in the text box it brings the calendar up, but when I select a date I get the error message:

Microsoft Access can't move the focus to the control Date Received(txt box).

Here is the code:

Private Sub Date_Received_Enter()
'Show Calendar and set its date.
Calendar.Visible = True
Calendar.SetFocus
'Set to today if Date Received has no value.
Calendar.Value = IIf(IsNull(Date_Received), Date, Date_Received.Value)

End Sub

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

End Sub

Any Suggestions?
 
I figured out the previous problem but I have another dilemma. When I click into the 'Date Received' txt box the Calendar pops up, but I want to make the calendar disappear when the mouse is not on it. So, say someone clicks into the text box and decides not to change the date and moves the mouse off of the calendar, Can someone suggest code that will make the calendar not visible.

Here is what I have so far:

Private Sub Date_Received_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
' Show Calendar and set its date.
Calendar.Visible = True
Calendar.SetFocus
' Set to today if Date Received has no value.
Calendar.Value = IIf(IsNull(Date_Received), Date, Date_Received.Value)

End Sub

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

End Sub

Thanks
 

Users who are viewing this thread

Back
Top Bottom