Access 2000: Setting default value for CalendarControl 9.0

  • Thread starter Thread starter Arvi Laanemets
  • Start date Start date
A

Arvi Laanemets

Hi

On unbound form, I have an unbound calendar control axDate (selected date is
passed to textbox txtDate in control's OnLostFocus event). In form's Open
event, I tried to initialize this calendar control:
Private Sub Form_Open(Cancel As Integer)
Me.axDate.Value = Date
...
End Sub

The code runs without any error, but the calendar control default value
remains unchanged (04.08.2005, as I created it yesterday). In Watch window I
can see, that Me.axDate.Value remains unchanged. I searched Web with Google,
but I did find only several advices to set control's value through code -
exactly what I did without any success!

Has someone some advice available? Thanks in advance!
 
Arvi,

I've had this before, and found that it will work in the On Load event,
but not the On Open event. My best guess is, because the ActiveX
calendar conrtrol is loaded from a file, the process is completed after
the Open event has actually fired, so the Open is too early.

HTH,
Nikos
 
Hi

With Load it really worked! Thanks!


Nikos Yannacopoulos said:
Arvi,

I've had this before, and found that it will work in the On Load event,
but not the On Open event. My best guess is, because the ActiveX calendar
conrtrol is loaded from a file, the process is completed after the Open
event has actually fired, so the Open is too early.

Hm... I watched it in debug mode - step-by-step. The code line where control
was initialized, was fired, but the control value didn't change at all. And
I could refer to calndar control freely - so it was loaded when Open event
was running jet.
 
Back
Top