Populate table fields when db is opened

Miff3436

Registered User.
Local time
Today, 22:50
Joined
May 27, 2015
Messages
23
Hi,

I have a table that has 3 fields in it, these are autoID, Date, and username. Is there a way that I can auto fill these fields each time the database is opened by a user.

I do not want any user input and for date I will set the default value to =Now(), the username to capture the Environ("username") and the autoID is just the auto number that will naturally increment each time the db is opened.

The reason for this is I want to build in a DLookup that will look at the last record to check the time it was last run as to whether or not a macro to import will run or not.

Thanks Miff 3436 (Using Access 2010)
 
Execute an append query in the open event of the form that opens with the db. Or

Code:
CurrentDb.Execute "INSERT INTO TableName(FieldName) VALUES ('" & Environ("username") & "')"
 
Hi pbaldy,

The append query works perfectly, thank you for the quick response.

Miff3436
 

Users who are viewing this thread

Back
Top Bottom