Trouble opening a recordset in Access 2007 form code
I'm using some very basic code copied from a project I did a couple of years ago.
In a Sub in the code page for a form in Access 2007, I'm using this code
Dim RS as Recordset
Set RS = CurrentDB.OpenRecordset("Select * from Table1")
It doesn't matter what I query, I get RS.Recordcount = 1, which I assume means it isn't getting the actual results
As I mentioned, I used this same code in another db before with no problem.
Also, in this same project, I've had no trouble using queries to populate objects.
It's the code above, just returning a recordset, that's causing the problem. And it isn't giving me any kind of error back. That's making it impossible for me to solve.
Any help would be appreciated.
Thanks.
Re: Trouble opening a recordset in Access 2007 form code
You have to MoveLast before reading the Recordcount so it will return the true number.
Re: Trouble opening a recordset in Access 2007 form code
do not rely on the recordcount property in ADO as it depends on cursortype and whether the recordset is dynamic, static or forward only
probably used to work ok in DAO