0

I am writing a code in Access VBA. I am facing an issue when using a recordset. Here is what I have in the first lines of my code:

Dim rst As Recordset
Dim sql as String

sql = "Select ........"
Set rst = CurrentDb.OpenRecordset(sql, dbReadOnly)

The program fails in the second line " set rst= .....". I added the following references: Visual Basic for Applications, Microsoft Access 12.0 Object library, OLE automation, Microsoft ActiveX Data Objects 2.8 Library

But the program still fails in the second line. Is there anything else I should do??? Thanks,

1
  • I also tried Dim rst As DAO.Recordset. but no luck Commented Jan 30, 2011 at 22:36

1 Answer 1

1

Currentdb is DAO code but you state you have an ADO reference. Remove the ADO reference and add the Microsoft Office 12.0 Access database engine Object Library.

If this were Access 2000, 2002 or 2003 I'd suggest adding the Microsoft DAO 3.6 Object Library.

Sign up to request clarification or add additional context in comments.

1 Comment

I removed the ADO reference. Now I have the following references: Visual Basic for Applications, Microsoft Access 12.0 Object library, OLE automation, and Microsoft Office 12.0 Access database engine Object Library. But the problem still remains. Any idea??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.