automatic update datetime fields

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Access Training and help » Automatic update to date/time fields?

Automatic update to date/time fields?

resolvedResolved · Urgent Priority · Version 2003

Gail has attended:
Access Intermediate course
Excel Advanced course

Automatic update to date/time fields?

Is there a way to get Access to automatically update a date/time field when a record is created or changed?

RE: Automatic update to date/time fields?

Dear Gail

Thank you for attending Access and Excel Courses!! I hope you enjoyed the courses and benefited from them.

This is quite simple.

1. Go to the table design view.

2. Click on the field where you want the updated date. Make sure the Data type is set as Date/Time

3. In the field Properties click where t says Default Value and type in =date()

4. Click on the field where you wan the time to be updated automatically. Ensure that the data type is set to Date/Time

5. In the field Properties click where it says Default Value and type in =time()

6. When you go to the datasheet view you'll be able to see the new record will have the date and time will automatically appear

Normally the default values on an existing field gets copied over if you create a form based on this table.


I hope this has answered your query.

If this has answered your query then I would request you to please mark the question as resolved!! If not and you have a specific question related to this then please post it as a new question and we should be able to provide you the solution for it!!

Kindest Regards


Rajeev Rawat
MOS Master Instructor 2000 and 2003
MCAS Master Instructor 2007

RE: Automatic update to date/time fields?

Hi Rajeev,

Many thanks for your explanation. It half answers my question, unfortunately it's the half I already knew about ;-)

I think this is easier to explain if I give you an example from my working life:

I receive a report form for a patient John Doe on 1st January.
We have a macro set up so that the data is automatically imported into the Access database, and given a date of 1st January.
A few weeks later, I am given some updated information, and amend John Doe's record in the database. The "date modified" field then needs to be updated to reflect the new date.

IF I remember, I will update the 'date modified' field myself. However this is a very important field for our audits, and it would be very useful if it could be set up so that Access automatically updates this field whenever a record is amended. At the moment if I do as you suggest and edit the Field Properties to =date() and =time(), it gives the correct date/time of the original import, but does not update when I edit the record a few minutes later - which is the more important bit.

I hope this makes sense and that you can help!!

Many thanks,
Gail

RE: Automatic update to date/time fields?

Dear Gail

Thank you for your response.

I have tried to look into this and unfortunately haven't been able to come up with the solution.

Temporarily I can suggest you to use the shortcut key CTRL +; which also inserts current date but doesn

RE: Automatic update to date/time fields?

Thu 26 Mar 2009: Automatically marked as resolved.


 

Access tip:

Create calculated fields that work out your age

You can uset eh year function to work out the year from NOW function and then subtract it with your date of birth type field

Age=Year(Now( ))-Year([DoB])

View all Access hints and tips


Server loaded in 0.09 secs.