I have the following code. It's supposed to count the number of records in one recordset and compare that to the number of records in the second recordset:
The odd thing is, unless I loop through the first recordset, it returns the value '1' no matter how many records I have in the set. With the loop in I get the correct number.
What gives?
Thanks in advance,
Onwards,
Q-
Code:
Dim dbTag As Database
Dim dbStep As Database
Dim rsTag As DAO.Recordset
Dim rsStep As DAO.Recordset
Dim strSQLSource As String
Dim TagRecord As Record
strSQLSource = "SELECT TagName, StepTagName FROM tblStepActions"
strSQLSource = strSQLSource & " WHERE TagName = " & "'" & Me.TagName & "'"
Set dbTag = CurrentDb()
Set rsTag = dbTag.OpenRecordset(strSQLSource)
strSQLSource = "SELECT TagName, Sequence, TagTypeID FROM tblTags"
strSQLSource = strSQLSource & " WHERE Tagtypeid = 9"
strSQLSource = strSQLSource & " AND Sequence = " & Me.SeqNumber
Do While Not rsTag.EOF
rsTag.MoveNext
Loop
Set dbStep = CurrentDb()
Set rsStep = dbStep.OpenRecordset(strSQLSource)
Debug.Print rsTag.RecordCount
Debug.Print rsStep.RecordCount
rsTag.Close
dbTag.Close
rsStep.Close
dbStep.Close
End Sub
The odd thing is, unless I loop through the first recordset, it returns the value '1' no matter how many records I have in the set. With the loop in I get the correct number.
What gives?
Thanks in advance,
Onwards,
Q-