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
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
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
Thanks,
Mike
ASKER
Private Sub Form_Open(Cancel As Integer)
Me.Calendar3.Value = Date
End Sub
Me.Calendar3.Value = Date
End Sub
is your calendar bound to a field?
H
H
ASKER
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.
ASKER
No, it's not bound to a field.
ASKER
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
Mike
ASKER
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
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
ASKER
Bind it to what? A table with a field full of dates?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
then use the form_load event
private sub form_load()
Me!Kalendar = Date
end sub
ASKER
That did it! Thanks a lot H and Mike!
-marshall-
-marshall-
I made that recommendation in my first comment...Glad you got it to work.
Mike
Mike
ASKER
I was using the word Calendar as an example, I acctually have it called ctlCalendar3.
Me.ctlcalendar.Value = Date
I recommend prefixing the name of the calendar control with something ( I used ctl for control).
Mik