Hello,
I have a form that uses a combobox filter. it works for all the records except the first record. When I select the first record I get an error message..(Either BOF or EOF is True. I would assume that it would be true as the record selected is the very First One. I have played around with a few BOF if statements but can't seem to fix this problem.
The code below is from another idea that if I moved right to the first record in a recordset that I could then check to see if the ID Value matched that of the ComboBox. This doesn't work either.
Can anyone see anything obvious with this Procedure?
rstSuppliers is an ADO Recordset that is declared at the decleration section of this forms Module. It is Opened on the Sub Open event.
Private Sub cboSupplier_Click()
Dim intReturn As Integer
Dim strCriteria As String
Dim FullName As String
strCriteria = "SuppliersID = " & "'" & Me.cboSupplier & "'"
rstSuppliers.MoveFirst
If rstSuppliers!SuppliersID <> "'" & Me.cboSupplier & "'" Then
Me.cmdSave.Enabled = False
rstSuppliers.MoveFirst
rstSuppliers.Find strCriteria, 1, adSearchForward
End If
FullName = rstSuppliers!SuppliersName
intReturn = UnBoundDisplay(Me, rstSuppliers, FullName)
' Clear ComboBox
Me.cboSupplier = ""
End Sub
I have a form that uses a combobox filter. it works for all the records except the first record. When I select the first record I get an error message..(Either BOF or EOF is True. I would assume that it would be true as the record selected is the very First One. I have played around with a few BOF if statements but can't seem to fix this problem.
The code below is from another idea that if I moved right to the first record in a recordset that I could then check to see if the ID Value matched that of the ComboBox. This doesn't work either.
Can anyone see anything obvious with this Procedure?
rstSuppliers is an ADO Recordset that is declared at the decleration section of this forms Module. It is Opened on the Sub Open event.
Private Sub cboSupplier_Click()
Dim intReturn As Integer
Dim strCriteria As String
Dim FullName As String
strCriteria = "SuppliersID = " & "'" & Me.cboSupplier & "'"
rstSuppliers.MoveFirst
If rstSuppliers!SuppliersID <> "'" & Me.cboSupplier & "'" Then
Me.cmdSave.Enabled = False
rstSuppliers.MoveFirst
rstSuppliers.Find strCriteria, 1, adSearchForward
End If
FullName = rstSuppliers!SuppliersName
intReturn = UnBoundDisplay(Me, rstSuppliers, FullName)
' Clear ComboBox
Me.cboSupplier = ""
End Sub