Calendar1

I have the Calendar1 control on my form and when a textbox gets focus the calendar comes up. I would like it to display todays date, not a hard coded date.
Can this be done, if so how?

Thanks
mscalaAsked:
Who is Participating?
 
Eduard GherguConnect With a Mentor Leader SibiuCommented:
Private Sub Form_Load()
  Calendar1.Value = Now
End Sub
0
 
baltmanCommented:
You can do this by setting the properties for the calendar when the form loads (or on any action you choose). I will use the example when the form loads:

Private Sub Form_Load()
  Calendar1.Day = dayNow
  Calendar1.Month = monthNow
  Calendar1.Year = yearNow
End Sub

You would have to assign the values to dayNow, monthNow and yearNow with the Date function.

Hope this helps.

BA
0
 
planoczCommented:
you can also use the format statement to view in your textbox....

calendar1.Value = now
text1.text = format(calendar1.Value, "mm/dd/yyyy")
0
All Courses

From novice to tech pro — start learning today.