OpenRecordset - Type Mismatch

W

Warren

I am having trouble retrieving a recordset
in the Form - Code section of a local database.
I never had this problem with Access97, but am now
experiencing it with Access2000.

Dim rs as Recordset

strSQL = "Select ........"
Set rs = CurrentDb.OpenRecordset(strSQL) - Type Mismatch
occurs on this line.

I've also tried using the DoCmd.RunSQL, and using
ADODB.Recordsets instead, but none of them work.

Any advice?

Thanks
Warren
 
T

Tim Ferguson

I never had this problem with Access97, but am now
experiencing it with Access2000.

Dim rs as Recordset

strSQL = "Select ........"
Set rs = CurrentDb.OpenRecordset(strSQL) - Type Mismatch

In the VBEditor, check Tools -> References and check the setting for
Microsoft Data Access Objects 3.6. Either move it above the ADO entry, or
uncheck ADO if you don't plan to use it.

DAO used to be default for Access 97, but it was changed to ADO for Access
2000 and upwards (although nobody told the Jet team...)

HTH


Tim F
 
D

Douglas J. Steele

Tim Ferguson said:
In the VBEditor, check Tools -> References and check the setting for
Microsoft Data Access Objects 3.6. Either move it above the ADO entry, or
uncheck ADO if you don't plan to use it.

DAO used to be default for Access 97, but it was changed to ADO for Access
2000 and upwards (although nobody told the Jet team...)

While moving the DAO reference higher in the list will work, I think you're
safer "disambiguating"

Dim rs As DAO.Recordset (or Dim rs As ADODB.Recordset), just so you know for
sure what you're getting.
 

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