R
RipperT
Original question: If the value in a form field will be
periodically changed(updated), how can I record the new
value, along with the date and time of the update, in
another table? I'm using Access 2002.
Someone suggested the following:
Use VBA DAO (or ADO) code to write a new Record to the
other Table.
The code would be something like this (air) code:
Dim db as DAO.Database
Dim rs as DAO.RecordSet
Set db = CurrentDB()
Set rs = db.OpenRecordset("anotherTable")
rs.AddNew
rs("FirstFld") = Me!txtFirstFld
rs("UpdatedDateTime") = Now
rs.Update
rs.Close
Set rs = Nothing
Set db = Nothing
I used this suggested code,and tweaked it for my
application. I don't know code (clearly) but I'm not an
idiot. I can make this work with you guys' help.
Where:
"seg" is the name of the database
"Lock changes" is the name of the table I want to write to
"Lock" is the field in "Lock changes" I want to update
from a (separate) form field
"Date" is the field in "Lock changes" I want the date
(Now) to show up in each time the value in the form field
is changed
Private Sub Lock_Exit(Cancel As Integer)
Dim db As DAO.seg
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("Lock changes")
rs.AddNew
rs("Lock") = Me!txtLock
rs("Date") = Now
rs.Update
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
I get a compile error each time I leave the field. How do
I fix this code?
Thanx!
Rip
periodically changed(updated), how can I record the new
value, along with the date and time of the update, in
another table? I'm using Access 2002.
Someone suggested the following:
Use VBA DAO (or ADO) code to write a new Record to the
other Table.
The code would be something like this (air) code:
Dim db as DAO.Database
Dim rs as DAO.RecordSet
Set db = CurrentDB()
Set rs = db.OpenRecordset("anotherTable")
rs.AddNew
rs("FirstFld") = Me!txtFirstFld
rs("UpdatedDateTime") = Now
rs.Update
rs.Close
Set rs = Nothing
Set db = Nothing
I used this suggested code,and tweaked it for my
application. I don't know code (clearly) but I'm not an
idiot. I can make this work with you guys' help.
Where:
"seg" is the name of the database
"Lock changes" is the name of the table I want to write to
"Lock" is the field in "Lock changes" I want to update
from a (separate) form field
"Date" is the field in "Lock changes" I want the date
(Now) to show up in each time the value in the form field
is changed
Private Sub Lock_Exit(Cancel As Integer)
Dim db As DAO.seg
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("Lock changes")
rs.AddNew
rs("Lock") = Me!txtLock
rs("Date") = Now
rs.Update
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
I get a compile error each time I leave the field. How do
I fix this code?
Thanx!
Rip