novice needs help!!!!!!!
I am getting error 3021, (either BOF or EOF is true, or the current record has been deleted. requested operation requires a current record with this code.) i have a form that dispalys info from the recordset in text boxes, and the branch code automatically displays branch name in a textbox.this works fine on form load.
the problem is once the branch code changes, i get the above error. i know i am missing something very obious, but for the life of me i can't figure out what it is.
the sql statement also gives me a syntax error(missing operator) when i try to clear the contents of the textboxes.
ps; branch number datatype is text.
Private Sub txtBranchNo_change()
Dim con As ADODB.Connection
Dim rec As ADODB.Recordset
Dim strName As String
Set con = New ADODB.Connection
Set rec = New ADODB.Recordset
strName = "Select PHARMACYBRANCHCODES.[Branc
h No],PHARMACYBRANCHCODES.[B
ranch Name] From PHARMACYBRANCHCODES Where PHARMACYBRANCHCODES.[Branc
h No] =" & txtBranchNo.Text & ""
con.Open "Provider=Microsoft.Jet.OL
EDB.3.51;P
ersist Security Info=False;Data Source=C:\fyfy\hguyg.mdb"
rec.Open strName, con
If rec.RecordCount <> 0 Then
rec.MoveFirst
txtBranchName.Text = rec.Fields("Branch Name")
End If
End Sub
Start Free Trial