我想编写一个非常简单的查询并将其绑定到带有 VBA 代码的列表框,但是运行这段代码会发生错误:
Private Sub Command0_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM funk", dbOpenTable)
Me.List9.Recordset = rs
End Sub
数据库的名称是正确的。你能告诉我如何解决这个问题吗?
编辑
我已将代码更改为
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM funk")
Me.List9.Recordset = rs
但它也不起作用