I have a form with a recordsource
SELECT * FROM TABLE_A WHERE BRANCHES ='OPEN'
This form has several textfields and combo boxes which are bound. I have one combo box cboName bound to the Form, which I would like to use as a search field, in the sense that if I type a few letters in the combo box, then my selection from the combo box should only have the names which are possible from the letter typed. Then selecting one of the choices should give me an update to the form. So I thought this procedure would make sense in the cbo_Afterupdate
Private Sub cboName_AfterUpdate()
Me.Filter = ""
Me.FilterOn = False
If Len(Me.cboName.Value) > 0 Then
Me.RecordSource = "SELECT Name FROM TABLE_A WHERE Name Like '*" & Me.cboName.Value & "*'"
Me.cboName.Requery
Else
Me.RecordSource = "SELECT Name FROM TABLE_A "
Me.cboName.Requery
End If
If Not IsNull(Me.cboName.Value) Then
Me.Filter = "Name = '" & Me.cboName.Value & "'"
Me.FilterOn = True
End If
End Sub
Now, I get an error 3464(data conflict) on the line Me.FilterOn = True
I noticed that with f5 it continues, but the form is not filled, what am I missing?
Thanks in advance
The combobox must be unbound - or you will attempt to update and filter the form in one go, which you can't.