Pop Up Calendar has the wrong date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a reports form that allows the user to select certain reports based on
a date range. The to and from boxes are unbound text boxes:

txtTo
txtFrom

I have a double click event that opens the calendar form which is activex.
The calendars code is:

Option Compare Database

Private Sub actlCalendar_DblClick()
Dim dtmdate As Date

dtmdate = Me.ActiveControl.Value
DoCmd.Close acForm, Me.Name
Screen.ActiveControl.Value = dtmdate

End Sub


The code for the double click event is:

Private Sub txtFrom_DblClick(Cancel As Integer)
DoCmd.OpenForm "calendar"
End Sub

The problem is, when the calendar opens it retains the date that I made the
calendar, March 14, 2006. So, when I click on it today, it still shows March
14th. I would like it to shoe the current day, that way I don't have to
change the date everytime.

Any help would be appreciated.
 
Try this on the calendar Load event:

Private Sub Form_Load()
ActiveXCtl0.Value = Date

...assuming you are using Calendar control v.10.
 
knawtn via AccessMonster.com said:
Try this on the calendar Load event:

Private Sub Form_Load()
ActiveXCtl0.Value = Date

..assuming you are using Calendar control v.10.

And assuming that the Calendar control you added to the form is named
ActiveXCtl0....
 
I tried this code and it does not work for me. I may be putting it in the
wrong place. When I click properties on my calendar, there is not a form load
event... but I did an event procedure on update then changed it to form
load.. but it didn't work. Thanks for any and all help.

Jan
 
Form_Load is an event that occurs when the form is being loaded. It has
nothing to do with the calendar control itself. Make sure the code is
properly linked to the form's event.
 
Back
Top