Automatically adding current date into new record

Prysson

Registered User.
Local time
Today, 16:08
Joined
Sep 23, 2002
Messages
45
How would one go about an AddNew in an ADODB recordset for a field whose value is a date IF you want the date to be automatic.


So that if the code looks like this

Dim rst As New ADODB.Recordset
rst.Open"tblEvent", CurrentProject.Connection, adOpenKeyset, adLockPessimistic
rst.AddNew

rst.Fields("Date")=

rst.Update
rst.Close

the rst.Fields("Date") =

What is the correct way to make that pull in the current date?
 
If you want to add the current date each time a new record is created, why not set the Default Value of the field to Date() in the table. That way, every time you create a new record it will stamp it with the current date.
 

Users who are viewing this thread

Back
Top Bottom