Hi guys,
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 on 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 from one of the few, should give me an updated form with the selected name.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
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 on 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 from one of the few, should give me an updated form with the selected name.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