R
RipperT
OpenRecordset below generates a Type Mismatch error. All I want to do
is open tblLockHistory to one record (which is all the SELECT should fetch)
and write to it
programmatically. Help shows several different ways to do it, but they
all generate an error of some kind. I thought I'd get past this one
before moving on the next.
Thanx, Rip
Private Sub write_history(Optional ByVal outgoingId As Variant, Optional
ByVal incomingId As Variant)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Dim qdfTemp As QueryDef
Set qdfTemp = db.CreateQueryDef("", "SELECT
tblLockHistory.TransactionID, tblLockHistory.InmateId, " _
& "tblLockHistory.Institution, tblLockHistory.HousingUnit,
tblLockHistory.CellNo, " _
& "tblLockHistory.Bunk, tblLockHistory.DateTimeIn,
tblLockHistory.InUser, " _
& "tblLockHistory.DateTimeOut, tblLockHistory.OutUser FROM
tblLockHistory WHERE " _
& "(((tblLockHistory.InmateId)=outgoingId) AND
((tblLockHistory.DateTimeOut) Is Null));")
Set rs = db.OpenRecordset(qdfTemp)
is open tblLockHistory to one record (which is all the SELECT should fetch)
and write to it
programmatically. Help shows several different ways to do it, but they
all generate an error of some kind. I thought I'd get past this one
before moving on the next.
Thanx, Rip
Private Sub write_history(Optional ByVal outgoingId As Variant, Optional
ByVal incomingId As Variant)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Dim qdfTemp As QueryDef
Set qdfTemp = db.CreateQueryDef("", "SELECT
tblLockHistory.TransactionID, tblLockHistory.InmateId, " _
& "tblLockHistory.Institution, tblLockHistory.HousingUnit,
tblLockHistory.CellNo, " _
& "tblLockHistory.Bunk, tblLockHistory.DateTimeIn,
tblLockHistory.InUser, " _
& "tblLockHistory.DateTimeOut, tblLockHistory.OutUser FROM
tblLockHistory WHERE " _
& "(((tblLockHistory.InmateId)=outgoingId) AND
((tblLockHistory.DateTimeOut) Is Null));")
Set rs = db.OpenRecordset(qdfTemp)