Access 2013: working query cannot be read through DAO recordset
Posted on 2015-02-18
I'm experiencing a problem that I have never seen before:
- I have an Access query on a join of 3 tables in SQL Server. When I run that query manually, it works perfectly
- I need to use that query in a VBA routine, so I set a DAO recordset using the usual
Set rs = CurrentDb.OpenRecordset("SELECT * FROM queryName", dbOpenDynaset)
- the latter gives me either an error "Too few parameters. Expected 1.", or no error, but the recordset is set to nothing !
I mean, I have done this in 1000 other cases without the smallest trouble. What can be the reason for such an error ??
The strange thing is that, in the Access app, I need to access some tables over ADODB, so I have a reference to the ADO library. When I looked at my references, I noticed the DAO ref was missing, so I tried to add it. This, however, gives an error "Name conflicts with existing module, project, or object libray", which I also have never seen before. But when I dimension the recordset mentioned above as a DAO recordset, Access happily accepts it and compiles.
So I'm pretty lost and totally stuck with that application.
Thanks for help