default value for calendar on data entry form

P

paulold

I have added a calendar control to my data entry form in Access 2003. It's
called Calendar8. I have it tied to a field in my main table called
TransDate. The form is a little redundant in that it shows the calendar as
well as the value of the TransDate field, but I prefer that. When I advance
thru the existing records, the calendar shows the same date as what appears
in the TransDate field. When I create a new record, the date I select in the
calendar gets populated in the TransDate field. All that is working fine. But
when I create a new record, the calendar slips back in time to Oct of 2002,
which happens to be when my first record is from. This is inconvenient
because you have to then choose the Month and the Year on the calendar before
selecting a date, which takes too many steps. This form is supposed to speed
up data-entry. What I would prefer is to have the calendar show the current
date whenever I ask to create a new record. The current date won't always be
the correct date for the record, but it will be closer to the truth than Oct
of 2002. How can I do this? Also, just cause I would like to experiment,
could I instead get it to show the max date of my TransDate field instead of
the current date (meaning the latest date I've entered into this field so
far)? When I enter transactions, I roughly enter them in date order, oldest
to newest. Thanks!
 
P

paulold

I believe that would only set the value of the calendar to being the current
date, when I need it to show the value of the TransDate field on existing
records and the current date on newly created, empty records (until I choose
a value for TransDate). What does OnCurrent mean? Wouldn't that apply to the
existing records and not just the new ones?

tkelley via AccessMonster.com said:
Holy cow, I botched that one. I got a little mixed up.

Have you tried putting your calendar8.value=date() in your OnCurrent event
for the form? That's where I meant to go with this.
If you look at the properties/events of a calendar control, they aren't all
listed. However, if you go into the VBA code window and select your calendar
as the object, you'll see additional events that apply to calendars in the
events dropdown.

In that dropdown you can select OnCurrent. Then you can put your code to set
the calendar.value property.

Try that ...
I have added a calendar control to my data entry form in Access 2003. It's
called Calendar8. I have it tied to a field in my main table called
[quoted text clipped - 15 lines]
far)? When I enter transactions, I roughly enter them in date order, oldest
to newest. Thanks!
 
P

paulold

DUH! How could I miss something so obvious?? Since the calendar always shows
the value of the TransDate field in my main table, I simply set the default
value of the TransDate field to be Date() so that whenever a new record is
created, the current date gets populated there. If that's not the correct
date for the record, I can easily adjust it since the current date will be
near the actual trans date. Sometimes you gotta step away to see the simple
answer.

I believe that would only set the value of the calendar to being the current
date, when I need it to show the value of the TransDate field on existing
records and the current date on newly created, empty records (until I choose
a value for TransDate). What does OnCurrent mean? Wouldn't that apply to the
existing records and not just the new ones?

tkelley via AccessMonster.com said:
Holy cow, I botched that one. I got a little mixed up.

Have you tried putting your calendar8.value=date() in your OnCurrent event
for the form? That's where I meant to go with this.
If you look at the properties/events of a calendar control, they aren't all
listed. However, if you go into the VBA code window and select your calendar
as the object, you'll see additional events that apply to calendars in the
events dropdown.

In that dropdown you can select OnCurrent. Then you can put your code to set
the calendar.value property.

Try that ...

I have added a calendar control to my data entry form in Access 2003. It's
called Calendar8. I have it tied to a field in my main table called
[quoted text clipped - 15 lines]
far)? When I enter transactions, I roughly enter them in date order, oldest
to newest. Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top