Storing dates in a table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Greetings

I help run a karate club. In my database, I track attendance, instructors,
schedule.... etc. I have a form (frmPersonalData) that is used to input
athlete data into table (tblPersonalData).

When a NEW athlete registers for a season, I would like the current date to
be added automatically to a field in the table called txtFirstRegistered and
again to a field called txtLastRegistered. If the athlete re-registers, say
a few years later, I would like the txtLastRegistered field to be updated,
but the txtFirstRegistered field to remain unchanged. In other words, I need
to know the dates an athlete was first registered and last registered, even
if there were many registrations in between.

Being a programmer of very limited experience, I would value any help offered.

Much Thanks, Becky
 
assuming that the table holds only 1 record for each person, you can set the
DefaultValue property of both date fields to

=Date()

that will add the current date to the fields *when a record is created*.

to update the txtLastRegistered field, you have to decide when and how you
want this to happen. do you want the date to be updated whenever the record
is edited? that will only work if the record will *never* be edited between
one instance of registration and the next instance. do you want the user to
click a command button on the form when re-registering a person? easy enough
to do, but perhaps easy enough for the user to forget to do it. do you want
to build a form *specifically* to re-register an existing user? that would
be perhaps the easiest to control, with code in the form's BeforeUpdate
event procedure to set txtLastRegistered, as

Me!txtLastRegistered = Date

hth
 
tina - makes sense. I'll give it a try.
Becky

tina said:
assuming that the table holds only 1 record for each person, you can set the
DefaultValue property of both date fields to

=Date()

that will add the current date to the fields *when a record is created*.

to update the txtLastRegistered field, you have to decide when and how you
want this to happen. do you want the date to be updated whenever the record
is edited? that will only work if the record will *never* be edited between
one instance of registration and the next instance. do you want the user to
click a command button on the form when re-registering a person? easy enough
to do, but perhaps easy enough for the user to forget to do it. do you want
to build a form *specifically* to re-register an existing user? that would
be perhaps the easiest to control, with code in the form's BeforeUpdate
event procedure to set txtLastRegistered, as

Me!txtLastRegistered = Date

hth
 
Back
Top