• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 566
  • Last Modified:

Load Calendar value with current date on form open and change with user selection

I have a form with an ActiveX Calendar12 object. In control source for the object I have..."=Date()". When my form opens the calendar object loads with the current date like I want it to. I want the user to be able to pick another date and have the value of the object be this new date. As it stands now you cannot select another date and the value is always the current date.
Thanks for the help!
1 Solution
Rey Obrero (Capricorn1)Commented:
remove the = Date() from the control source.
Put Date() into the Default value of the field, or of the calendar control itself.

The user should then be able to select a date.
If you have no luck finding the default value for the calendar control, remove the control source AND use an On Open Event procedure for the form, this is how I have got aroung this in the past:

Private Sub Form_Open(Cancel As Integer)

Me.Calendar0.Value = Date

End Sub

sorry that should be:Private Sub Form_Open(Cancel As Integer)

Me.Calendar0.Value = Date()

End Sub
IronDriverAuthor Commented:
Curious thing here...I know both capricorn1 and dan's suggestions are effective. I looked at cap's file and is a nice solution. I tried to use dan's code in my current project and cannot get it to work. Yet if I open a new db and build a simple form with just the calendar object and the code it works exactly as I would like. I obviously have something causing the issue in my VB code but haven't found it yet.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now