Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1079
  • Last Modified:

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
0
inetomaha
Asked:
inetomaha
  • 9
  • 4
  • 3
  • +1
1 Solution
 
Data-ManCommented:
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
0
 
inetomahaAuthor Commented:
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?
0
 
Data-ManCommented:
can you post the code you are using?   Include the entire event procedure.

Thanks,
Mike
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
inetomahaAuthor Commented:
Private Sub Form_Open(Cancel As Integer)

Me.Calendar3.Value = Date

End Sub
0
 
hgj1357Commented:
is your calendar bound to a field?

H
0
 
inetomahaAuthor Commented:
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.
0
 
inetomahaAuthor Commented:
No, it's not bound to a field.
0
 
inetomahaAuthor Commented:
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.
0
 
Data-ManCommented:
What version of Access are you using?  What format is your database in (2000, 2002)?


Mike
0
 
inetomahaAuthor Commented:
Access 2003 (11.6355.6360) SP1
0
 
hgj1357Commented:
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
0
 
inetomahaAuthor Commented:
Bind it to what? A table with a field full of dates?
0
 
hgj1357Commented:
No, just one date field on the table behind the form that holds the calendar object.

The table could have just one record, you just need the date to filter your activities, and to anchor your calendar.

H
0
 
SidFishesCommented:
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
0
 
inetomahaAuthor Commented:
That did it! Thanks a lot H and Mike!

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

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

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

  • 9
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now