Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automating a Record in Access

Status
Not open for further replies.

doorok

Technical User
Mar 20, 2003
10
0
0
US
I have a table that has a date field as the primary key. One record is entered into the table daily via an Access form. Is there any way that I could automate the creation of a record in the table. I want the table to automatically insert a record with the current date at 12:00am every day. The date field is primary, so there will be exactly one record for each day. How would I go about automating the creation of a record.

Thanks
 
What I would do is put in a text box on the form, linking it to the primary field. Then on the BeforeInsert event of the form put this code:

Say the text box is called txtDate

Me!txtDate = Date()

There may be neater and more foolproof ways of doing it but that should do the job. You could set the property of the text box to locked, and even set the visible property to No if you don't want users messing with it.

hope it works for you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top