Link to home
Start Free TrialLog in
Avatar of inetomaha
inetomaha

asked on

Calendar Control 11.0 Default Date

I'm using the ActiveX Calendar Control 11.0 in Access and am having a difficult time setting its default value as today's date.

I've tried creating an event to run when the form opens to set the value using every combination I can think of or find on the web, any help would be great!

Here's what I've tried:

calendar.value=Date
calendar.value=Now()
calendar.today
Avatar of Data-Man
Data-Man
Flag of United States of America image

Try this..I use this in my Access application.

Me.ctlcalendar.Value = Date

I recommend prefixing the name of the calendar control with something ( I used ctl for control).

Mik
Avatar of inetomaha
inetomaha

ASKER

No Dice, it still shows up with no date selected. Is this something I shouldn't be putting in the VB code and I should have it else where?
can you post the code you are using?   Include the entire event procedure.

Thanks,
Mike
Private Sub Form_Open(Cancel As Integer)

Me.Calendar3.Value = Date

End Sub
is your calendar bound to a field?

H
Basically I have the control on a form and I want it to default to today's date, so I put the code to set the date in the form open event procedure, seeing as how the control doesn't have the option for an "On Open" event.
No, it's not bound to a field.
The form shows the user a dispatch sheet to track employees and their jobs/tasks for the day. I want the calendar to default to the current date and then thus show the current day's tasks for the employees based on the calendar but the darn thing is being stubborn.
What version of Access are you using?  What format is your database in (2000, 2002)?


Mike
Access 2003 (11.6355.6360) SP1
Use a bound date field.

This will help you to show activities, as you can link a subform to this field.

then use these:

Private Sub Calendar3_click()
Me.MyDateField.SetFocus
End Sub

Private Sub Form_Load()
Me.MyDateField = Date
End Sub
Bind it to what? A table with a field full of dates?
ASKER CERTIFIED SOLUTION
Avatar of hgj1357
hgj1357

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SidFishes
name your calendar control something like Kalendar (seem to remember it doesn't like calendar)


then use the form_load event

private sub form_load()
 Me!Kalendar = Date
end sub
That did it! Thanks a lot H and Mike!

-marshall-
I made that recommendation in my first comment...Glad you got it to work.

Mike
I was using the word Calendar as an example, I acctually have it called ctlCalendar3.