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,