Recordset error

suburbanpsyco

Registered User.
Local time
Today, 16:33
Joined
Apr 18, 2011
Messages
19
Been banging my head off a relatively simple problem for hours. any help would be appreciated.

the following is my code:

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
Now the problem. the readVendor event works fine on formload, but on the click event it produces an error 3021: either BOF or EOF or recordset deleted? Ideas? Thanks in advance
 
Last edited:
Set a breakpoint on the Call readVendor line and check the value of Me.lstVendors is what you expect.
 

Users who are viewing this thread

Back
Top Bottom