Strange behavior with query and rs.Recordcount

J

John J.

I have the following code which executes a query with criteria which comes
from a form:

Set db = CurrentDb
Set qdf = db.QueryDefs("qryMyQuery")
For Each parm In qdf.Parameters
parm.Value = Eval(parm.Name)
Next parm
Set rs = qdf.OpenRecordset
MsgBox rs.RecordCount

The msgbox returns 1 but if I run the query manually it gives me 2 records
(which is the right number).

Can someone help me out?
Thank you.
John
 

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