Same query string works in builder but not in code???

Joined
Mar 1, 2006
Messages
2
Reaction score
0
In code I build a query via a string variable (strQuery).
I debug and print out and copy strQuery and paste it into SQL view of the query builder.
When I run the SQL in query builder I get 2 records returned....Perfect and what it is supossed to be.
When I run it in code via a recorset (Set rsRelationships = CurrentDb.OpenRecordset(strQuery)) and then debug print out the recordset.recordcount (rsRelationships.RecordCount) it = 12 records returned.

I even tried setting the recordset = nothing (Set rsRelationships = Nothing) and setting my string variable to be empty (strQuery = "") in the beginning.

What is going on? Why do I get one set of records in query builder and another set in code using the same string?
 
Joined
Mar 1, 2006
Messages
2
Reaction score
0
Someone in another group gave me the answer

Apparently in Access 2000 you have to move to the last record before the recordcount property will give you the correct reading.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top