This is what I did to make the a text box equal to the value of the calendar control.
first i created a form load event making the calendar control value equal to the current date.
Private sub form_load()
Me!ocxCalCon.Today
End Sub
(the ocxCalCon is the name of my calendar control sub your calendar name in its place) doing this makes the calendar appear highlighted to the current date when the form loads. Great for giving them a starting date place.
Second i created a click event so when the user clicked on a date in the calendar control the associated text box would display the date/value that the user selected.
Private Sub ocxCalCon_Click()
txtDateSelected.Value = ocxCalCon.value
Me.Requery
End Sub
I am taking the text box txtDateSelected and making its value equal to the value of the calendar control value. Since my form is bound to a query I added a line to requery the query. I use the text box as a criteria for the query in order to keep what is displayed on the form current with what ever date the user selects. It works quite well. The user's like it anyway.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.