Calendar control default date

  • Thread starter Thread starter Tom Ross
  • Start date Start date
T

Tom Ross

an additional question. How do I make a calendar control default to the
current date. this has bugged me for some time.

Thanks

Tom
 
Tom,

Put the following code in the OnOpen event of your calendar form:

Me!NameOfCalendarControl.Value = Date()
 
Thanks

Tried that before and doesnt seem to work

I am using two unbound calendar controls on my form txtStartWeek and
txtFinishWeek
they are of type
calendar
MSCAL.calendar.7

I have this code in my form open event

Private Sub Form_Open(Cancel As Integer)
Me.txtStartWeek.Value = Date()
Me.txtFinishWeek.Value = Date()
End Sub

It doesn't work. I tried setting the value parameter in the control
properties to Date()--it wouldnt take it or Null--didnt make any difference.

What else can I try

Tom
 
Move the code to the Load event instead of the Open event.
The Open event is too soon.

If it still does not work try this in the Load event:

Private Sub Form_Load()
Me.txtStartWeek.Today
Me.txtFinishWeek.Today
End Sub

(Assuming those are the actual names of the calendar controls.)
 
Jeff

the Load Event is where it needed to be. My previous code worked there .
Have a nice weekend

Tom
 
Back
Top