J
Joe Cletcher
If I use the following query in the database window, the query returns the
correct number of records (22). However, if I open the recordset from within
a VBA subroutine the query returns only 1 record. If the query were to work
correctly, the hard coded value of "81" would be replaced with a variable
similar to "aTrngAreaID".
Dim aTrngAreaID As Long
Dim db As DAO.Database
Dim QryTxt As String
Dim rs As DAO.Recordset
Dim rsAreas As DAO.Recordset
Dim rsAreaTrng As DAO.Recordset
Dim rsPersons As DAO.Recordset
Set db = CurrentDb
..
..
..
QryTxt = "SELECT TrngTypeArea.TrngTypeID FROM TrngTypeArea WHERE
(((TrngTypeArea.TrngAreaID)=81))"
Set rsAreaTrng = db.OpenRecordset(QryTxt)
correct number of records (22). However, if I open the recordset from within
a VBA subroutine the query returns only 1 record. If the query were to work
correctly, the hard coded value of "81" would be replaced with a variable
similar to "aTrngAreaID".
Dim aTrngAreaID As Long
Dim db As DAO.Database
Dim QryTxt As String
Dim rs As DAO.Recordset
Dim rsAreas As DAO.Recordset
Dim rsAreaTrng As DAO.Recordset
Dim rsPersons As DAO.Recordset
Set db = CurrentDb
..
..
..
QryTxt = "SELECT TrngTypeArea.TrngTypeID FROM TrngTypeArea WHERE
(((TrngTypeArea.TrngAreaID)=81))"
Set rsAreaTrng = db.OpenRecordset(QryTxt)