Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A2007/2010 set form recordset - error 7965

Status
Not open for further replies.

formerTexan

Programmer
Apr 10, 2004
504
0
0
US
Greetings everyone,

Binding DAO recordsets to a form raises Error 7965("The object you entered is not a valid recordset property".

Code:
Dim rs As DAO.Recordset
    Set rs = CurrentDb.OpenRecordset("tblProject", dbOpenTable)
    Debug.Print rs.RecordCount  'sanity check
    Set Me.Recordset = rs  'error 7965("The object you entered is not a valid recordset property".
    
    rs.Close
    Set rs = Nothing

Here are the configurations that produced the error. All are running on a 32bit Windows7 with 32bit A2010 installed.

So far I've tried DAO 3.6 and 14.0 versions. Also tried pre-2007 databases and A2007 version databases created in A2010.

However if I run a pre-2007 database in XP mode, the error doesn't occur. Nor is there an issue if I bind an ADO recordset to a form in a A2007/2010 version.

Any thoughts on what may be happening? Is there some A2010 form property I'm unaware of?

Cheers,
formertexan

 
Set rs = CurrentDb.OpenRecordset("tblProject", dbopendynaset)

I do not think that will work with a table type.
Always specify the type you want. Dynaset guarantees your code will work for all queries and tables, local and attached.
 
Hello MajP,

You are right. Of course that's why form's RecordsetType property is limited to Dynaset or Snapshot. Thank you.

formertexan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top