I have a question about DAO recordsets that is sort of baffling me. If anyone has run into this or it is a common problem, here is the problem.
When I run this code the rst.recordcount is 26, which is correct only if I am using the first part of the strSQL -
When I add the "AND" part, the recordcount should only = 1
However when I use this Code -
- the recordcount = 1 just like it is supposed to.
I have racked my brain, I have run the queries with the strSQL statements but to no reward.
I am confused as to why my first set of code returns the wrong recordcount and the second set of code returns the correct recordcount.
Caleb
Code:
strSQL = "SELECT * FROM tblLogSongs WHERE LogRef = " & TempRef & _
"AND SongPosition = " & Position
Set rst = db.OpenRecordset(strSQL)
If rst.RecordCount > 0 Then
When I run this code the rst.recordcount is 26, which is correct only if I am using the first part of the strSQL -
Code:
"WHERE LogRef = " & TempRef
When I add the "AND" part, the recordcount should only = 1
However when I use this Code -
Code:
strSQL = "SELECT * FROM tblLogSongs WHERE LogRef = " & TempRef & _
" AND SongRef = " & TempRef2
Set rst = db.OpenRecordset(strSQL)
- the recordcount = 1 just like it is supposed to.
I have racked my brain, I have run the queries with the strSQL statements but to no reward.
I am confused as to why my first set of code returns the wrong recordcount and the second set of code returns the correct recordcount.
Caleb