R
RipperT
I have code that looks like the following in the afterupdate event of a
text field that programmatically writes a record to a table. For
instance, if an inmate moves into a bunk, the record is filled with an
"in" date and time (as below). When the inmate later moves out of the
bunk, I need to locate that same record and write the date and time to
the "out" fields. How can I locate this record and write to it? I've
tried using .Seek "=" .InmateId.OldValue, but an error says it's not
supported. I am using a table-type recordset with an index, so I don't
understand why.
How do I call up this record and add the data?
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblLockHistory")
rs.AddNew
rs!InmateId = Me!InmateId.OldValue
rs!Institution = Me!Institution.OldValue
rs!HousingUnit = Me!HousingUnit.OldValue
rs!CellNo = Me!CellNldValue
rs!Bunk = Me!Bunk.OldValue
rs!DateIn = Date
rs!TimeIn = Time
rs!User = [CurrentUser]
rs.Update
Many thanx,
Rip
text field that programmatically writes a record to a table. For
instance, if an inmate moves into a bunk, the record is filled with an
"in" date and time (as below). When the inmate later moves out of the
bunk, I need to locate that same record and write the date and time to
the "out" fields. How can I locate this record and write to it? I've
tried using .Seek "=" .InmateId.OldValue, but an error says it's not
supported. I am using a table-type recordset with an index, so I don't
understand why.
How do I call up this record and add the data?
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblLockHistory")
rs.AddNew
rs!InmateId = Me!InmateId.OldValue
rs!Institution = Me!Institution.OldValue
rs!HousingUnit = Me!HousingUnit.OldValue
rs!CellNo = Me!CellNldValue
rs!Bunk = Me!Bunk.OldValue
rs!DateIn = Date
rs!TimeIn = Time
rs!User = [CurrentUser]
rs.Update
Many thanx,
Rip