I'm trying to use the calendarVB control in Access 2000
I have a button to toggle the calendar on and off, the code is
Private Sub Command31_Click()
' display calender
If CalendarVB0.Visible = False Then
CalendarVB0.Visible = True
Else
If CalendarVB0.Visible = True Then
CalendarVB0.Visible = False
End If
End If
End Sub
Then, when a new date is selected I want to update the value of a textbox, so I have this code in the OnUpdated property of the calendar
Private Sub CalendarVB0_Updated(Code As Integer)
' when new date is selected update delivery date textbox
Dim newdeldate As Date
newdeldate = CalendarVB0.Value
DateOfDelivery.Text = newdeldate
End Sub
When run this generates this error
You cant reference a property or method unless the control has the focus
I think it must be because when the form loads the calendars visible property is set to false. But I cant see what the problem is because the calendarvb_updated sub shouldn't run unless a date is clicked on.
How can I fix this?
I have a button to toggle the calendar on and off, the code is
Private Sub Command31_Click()
' display calender
If CalendarVB0.Visible = False Then
CalendarVB0.Visible = True
Else
If CalendarVB0.Visible = True Then
CalendarVB0.Visible = False
End If
End If
End Sub
Then, when a new date is selected I want to update the value of a textbox, so I have this code in the OnUpdated property of the calendar
Private Sub CalendarVB0_Updated(Code As Integer)
' when new date is selected update delivery date textbox
Dim newdeldate As Date
newdeldate = CalendarVB0.Value
DateOfDelivery.Text = newdeldate
End Sub
When run this generates this error
You cant reference a property or method unless the control has the focus
I think it must be because when the form loads the calendars visible property is set to false. But I cant see what the problem is because the calendarvb_updated sub shouldn't run unless a date is clicked on.
How can I fix this?