Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calender Current Date 1

Status
Not open for further replies.

Zepher2

Technical User
Dec 29, 2001
25
US

Using information garnered from this site, I have placed an ActiveX calender control on a subform which I use to select a date and insert that date into a field. When opening the subform I would like the calendar to start at the current month and date. Presently, the calendar starts at the month, day and year set in the properties.

Is there a way to have the calendar get the system date and automatically display the month and day from the system date?

I am not very experienced in VBA.

Thanks in advance.
 
In the properties where it currently has a date set, you should just be able to replace that with 'Date()' (minus the apostrophes). That's the Access fuction that returns the current date.

Is the properties field with the date the one called 'Default' or 'Default Value'? -- Herb
 
In the Calendar properties there is a field for month, day, year and value. I entered Date() into the value field and this reset the other fields to 0 and now the calendar displays January 2002. I think I'm on the right track but I still can't get it to highlight the day of the month.
 
Sorry, I just checked the calendar control that comes with Access, on my machine Calendar Control 8.0. It has no default property. So it's a little tricker to give it a default property on a new record, but not that hard.

In the 'On Current' event of the form, put these lines of code:
----------------------------
if me.newrecord then
me.[nameofcalendarcontrol].value = date
end if
----------------------------

That will default the calendar control to the current date for new records. -- Herb



 
HI,

I am looking to do the same thing how do you get the date that you select from the calendar into a text box?

Thanks In Advance
 
Lee24 -- If the calendar control is bound to a field, then you can just place a textbox on the form that is bound to the same field. It will update when you choose a new value on the Calendar, but not until you select the date on the calendar control AND move off of the calendar control to another control on the form.

If you don't want the text box or calendar bound to a field, you can set the text box's control source to:

=[nameofcalendarcontrol].value

This will work the same way as the bound controls, text box will update but not until you move off the calendar control.

If both controls are bound to a date field, then you can edit either the calendar control or the text box and either will update to reflect the other. If you're using the unbound textbox, you won't be able to edit it; all editing must be of calendar control. -- Herb
 
Hsitz,
That did the trick. Thank you for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top