M
Mark Hammer
Problem: opening a recordset in code returns only one record when it should
return two.
Details:
In VBA I construct a SQL string as follows:
strSQL = _
"SELECT FacultyID_NUM, LOAD_PERCENTAGE FROM tblFacultyLoadTable_Local
WHERE CRS_CDE='WR 323 EB'
AND tblFacultyLoadTable_Local.Year=2007
AND tblFacultyLoadTable_Local.Term=1;"
Debug.Print strSQL
Then I open a DAO.recordset as follows:
Set rsTemp = _
CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)
and check the records returned:
debug.print rsTemp.RecordCount
I get one record.
Trouble is, if I copy the SQL from the Immediate window and paste it into
the SQL pane of a new query, it returns two records, which is what I am
expecting.
How can it be that the recordset opened in code returns one record, while a
query having the identical SQL returns two records?
Mark Hammer
Puzzled in Lake Oswego, Oregon
return two.
Details:
In VBA I construct a SQL string as follows:
strSQL = _
"SELECT FacultyID_NUM, LOAD_PERCENTAGE FROM tblFacultyLoadTable_Local
WHERE CRS_CDE='WR 323 EB'
AND tblFacultyLoadTable_Local.Year=2007
AND tblFacultyLoadTable_Local.Term=1;"
Debug.Print strSQL
Then I open a DAO.recordset as follows:
Set rsTemp = _
CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)
and check the records returned:
debug.print rsTemp.RecordCount
I get one record.
Trouble is, if I copy the SQL from the Immediate window and paste it into
the SQL pane of a new query, it returns two records, which is what I am
expecting.
How can it be that the recordset opened in code returns one record, while a
query having the identical SQL returns two records?
Mark Hammer
Puzzled in Lake Oswego, Oregon