Insert date into form field on record creation, modification

  • Thread starter Thread starter Andrew L.
  • Start date Start date
A

Andrew L.

I would like the current date (short date is fine) to be auto-entered
into either DateAdd or DateModified on edit or creation of records.

Ideally, I would like to set the form as read-only, then have 2
controls (buttons), one Edit Record and one Add Record, the above
functionality being added to the on-click event of each. Any resources
or help most appreciated.

As it stands, the parent form is frmArtists (based on an Artists
table), and the subform is sfrmShowsDetail (based on a query whose
source is a Shows table).
 
I would like the current date (short date is fine) to be auto-entered
into either DateAdd or DateModified on edit or creation of records.

Ideally, I would like to set the form as read-only, then have 2
controls (buttons), one Edit Record and one Add Record, the above
functionality being added to the on-click event of each. Any resources
or help most appreciated.

As it stands, the parent form is frmArtists (based on an Artists
table), and the subform is sfrmShowsDetail (based on a query whose
source is a Shows table).

Use the BeforeUpdate event of the Form for Date stamping your records.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
Andrew L. said:
I would like the current date (short date is fine) to be auto-entered
into either DateAdd or DateModified on edit or creation of records.

This is a great question, as we get to learn why ms-access has several
different events on a form.

ok...we have two fields.....

For the DateAdd field, we will use the before insert event

me!DateAdd = date

The before insert event is a good event to use.

This event ONLY FIRES when a new record is added.

For the DateModified field, we will use the before update event

me!DateModified = date

the before update event ONLY fires when the user edits a record, so if they
just look at the record, the above code will not change..
 

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

Back
Top