Hello All,
I am trying to start a clock when I add a record to the table ( like a timestamp) how can I do it using VBA can any one give inputs on the VBA code.
Thanks
If your intent is to put a Date_TimeStamp on a record, then you must have a field on each record to hold the DateTime value.
Suppose you have a Table -- MyTable
with fields Fld1, Fld2 and DateStamp.
When you create a record, you set the value of DateStamp to
Now.
Now is a built-in function that returns the system current Date and time.
vba code may look like this
.
- .......
-
Dim dbs as dao.database
-
Dim rst as dao.recordset
-
Set dbs = CurrentDb
-
Set rst = dbs.OpenRecordset("MyTable")
-
With rst
-
.AddNew
-
-
![DateStamp] = Now ' <--This would add datestamp to the record
-
![fld1] = "Tom Brown"
-
![fld2] = "Microsoft XP"
-
-
.Update
-
.Close
-
End With
-
............
-