记录集错误VBA Access 2007

| 我在使我的记录集在以下代码中正常工作时遇到问题,并且不确定这是否是VBA固有缺陷的一部分人为运行时错误。代码如下
Option Compare Database

Option Explicit

Dim dbInquiry As New ADODB.Connection

Dim rstVendor As New ADODB.Recordset

Private Sub Form_Load()

    Set dbInquiry = CurrentProject.Connection
    rstVendor.Open \"Select * from Vendors Order By VendorName\", dbInquiry, adOpenKeyset, _
    adLockOptimistic, adCmdText

    Me.lstVendors = rstVendor!VendorNo
    Me.lstVendors.Requery
    Call readVendor

End Sub

Private Sub readVendor()

    Me.lblVendorNumber.Caption = rstVendor!VendorNo
    Me.lblVendorName.Caption = rstVendor!VendorName
    Me.lblVendorAddress.Caption = rstVendor!Address1
    Me.lblVendorCity.Caption = rstVendor!City & \", \" & rstVendor!Prov
    Me.lblVendorPostal.Caption = rstVendor!PostCode

End Sub


Private Sub lstVendors_Click()

    rstVendor.MoveFirst
    rstVendor.Find \"VendorNo = \" & Me.lstVendors
    Call readVendor

End Sub
现在,问题在于读取数据库。在窗体加载时调用方法readVendor时,它可以正常运行。在第一个项目单击时调用它,我得到错误3021:BOF,EOF或记录已删除。非常感谢任何指导。提前致谢     
已邀请:
rstVendor.Find \“ VendorNo = \”&Me.lstVendors 找到了什么吗?和/或rstVendor是否仍然打开?     

要回复问题请先登录注册