Create Date

G

Guest

How do I add a Create Date/Time field to a table that will recored the date/time a record is created? This has to be an easy one.
 
D

Douglas J. Steele

Add a field to the table and set its default value to Date() for date only,
or Now() for date and time.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Laura said:
How do I add a Create Date/Time field to a table that will recored the
date/time a record is created? This has to be an easy one.
 
B

Brian Kastel

As long as data entry will only take place via forms, yes, it is. Add the
following code to the bound form's BeforeInsert event:

Me.CreateDate = Now

Of course, your field, CreateDate, must have an associated bound control on
the form for this to work.

--

--
Brian Kastel


--Original Message----------------

How do I add a Create Date/Time field to a table that will recored the
date/time a record is created? This has to be an easy one.
 
B

Brian Kastel

Even Better! Thanks.

--
Brian Kastel


--Original Message----------------

Add a field to the table and set its default value to Date() for date only,
or Now() for date and time.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Laura said:
How do I add a Create Date/Time field to a table that will recored the
date/time a record is created? This has to be an easy one.
 
G

Guest

I was assuming that date() and now() would change the date everytime the table was modified, versus the date staying as it was when the record was created

----- Douglas J. Steele wrote: ----

Add a field to the table and set its default value to Date() for date only
or Now() for date and time

--
Doug Steele, Microsoft Access MV
http://I.Am/DougSteel
(no e-mails, please!


Laura said:
How do I add a Create Date/Time field to a table that will recored th
date/time a record is created? This has to be an easy one
 
D

Douglas J. Steele

"Default value" means give the field the value if it doesn't have one. If
the field has a value already, it won't be changed.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Laura said:
I was assuming that date() and now() would change the date everytime the
table was modified, versus the date staying as it was when the record was
created.
 

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