G
Guest
Hi Folks! I've got a form with three search combos on it. Each doing a
record search on different criteria. They seem to be conflicting, in
someway. When a selection is made in one, you can't use another. I've also
noticed that when records are changed or created that the record sets in the
comboboxes aren't updated even after a requery. I had thought that the
solution was to clear the recordset after each search, but I'm having no
luck. Here a sample of the code I'm using in my combos:
Private Sub cboSrchbyOrder_AfterUpdate()
Dim rs As DAO.Recordset
If Not IsNull(Me.cboSrchbyOrder) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[Order Number] = '" & Me.cboSrchbyOrder & "'"
If rs.NoMatch Then
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
Me.cboSrchbyOrder = Null
End Sub
Originally, I had the wizard create this code for me. Then I tried Allen
Browne's method, but I get similar results. The error I get is:
Run-Time Error '2115':
The macro or function set to the BeforeUpdate or ValidationRule property for
this field is preventing Microsoft Office Access from saving the data in the
field.
It fails on this line:
Me.Dirty = False
Whenever I try to use more than one combobox or if I try to conduct more
than one search. Anybody have any ideas?
record search on different criteria. They seem to be conflicting, in
someway. When a selection is made in one, you can't use another. I've also
noticed that when records are changed or created that the record sets in the
comboboxes aren't updated even after a requery. I had thought that the
solution was to clear the recordset after each search, but I'm having no
luck. Here a sample of the code I'm using in my combos:
Private Sub cboSrchbyOrder_AfterUpdate()
Dim rs As DAO.Recordset
If Not IsNull(Me.cboSrchbyOrder) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[Order Number] = '" & Me.cboSrchbyOrder & "'"
If rs.NoMatch Then
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
Me.cboSrchbyOrder = Null
End Sub
Originally, I had the wizard create this code for me. Then I tried Allen
Browne's method, but I get similar results. The error I get is:
Run-Time Error '2115':
The macro or function set to the BeforeUpdate or ValidationRule property for
this field is preventing Microsoft Office Access from saving the data in the
field.
It fails on this line:
Me.Dirty = False
Whenever I try to use more than one combobox or if I try to conduct more
than one search. Anybody have any ideas?