Hi all, I'm getting the error:
"Run-time error '3021': Either BoF or EOF is True, or the current record has been deleted. Requested operation requires a current record"
when i run this code below. I'm trying to populate a combobox with supplier names from a table.
Any help would be appreciated
thanks much.
"Run-time error '3021': Either BoF or EOF is True, or the current record has been deleted. Requested operation requires a current record"
when i run this code below. I'm trying to populate a combobox with supplier names from a table.
PHP:
Sub getSupNamFromDB()
Dim conn As ADODB.Connection
Dim supName As ADODB.Recordset
Dim strConn As String
Dim supArr As Variant
strConn = "Provider = Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & ThisWorkbook.Path & "\eps.mdb"
Set conn = New ADODB.Connection
conn.Open strConn
Set supName = New ADODB.Recordset
supName.Open "SELECT * FROM supplier_table", conn, adOpenDynamic, adLockOptimistic, adCmdText
If Not (supName.BOF And supName.EOF) Then
For Each Field In supName.Fields
supArr = supName("sup_name").value
'txtDescInvItem.RowSource = supArr
'MsgBox "found"
supName.MoveNext
Next
txtDescInvItem.RowSource = supArr
End If
supName.Close
Set supName = Nothing
conn.Close
Set conn = Nothing
End Sub
Any help would be appreciated
thanks much.