记录集错误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或记录已删除。非常感谢任何指导。提前致谢
没有找到相关结果
已邀请:
1 个回复
肉脓措伪