开发者

Recordset fails in Access 2007 VBA

开发者 https://www.devze.com 2023-02-07 08:29 出处:网络
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:

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,


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消