D
DeVille
Hi
I have this combo box on my form that finds a record
based on the value I select from the drop down list. The
problem is that since I added a command to the
forms 'Current' event the combo box doesn't work
properly.
If there is already a filter applied when I search for a
record by selecting a value in the combo box, the code in
the combo box's after update event is supposed to turn
the filter off then perform its search, which used to
work fine until I added another piece of code to the
forms 'Current' event. The code on the form's current
event changes the value in the combo box to Null after
the search has been performed so that database users are
not confused about which record they are on. At the
moment to find a record I have to use the combo box
twice. The first time removes the filter and the second
time finds the record, but what I really want to be able
to do is do it all in one action.
If any one can suggest a different way to clear the
value from combo box after the combo box has done its job
or a different way to remove the filter so that the combo
box can perform its search in one action thanks in
advance. (See code below)
This(below) is the code attached to the combo box's after
update event
Private Sub cboFindLocation_AfterUpdate()
' Find the record that matches the control.
If Me.FilterOn Then
Me.FilterOn = False
End If
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[LocationID] = " & Str(Nz(Me!
[cboFindLocation], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
This(below) is the code attached to the form's current
event
Private Sub Form_Current()
Me.cboFindLocation = Null
End Sub
I have this combo box on my form that finds a record
based on the value I select from the drop down list. The
problem is that since I added a command to the
forms 'Current' event the combo box doesn't work
properly.
If there is already a filter applied when I search for a
record by selecting a value in the combo box, the code in
the combo box's after update event is supposed to turn
the filter off then perform its search, which used to
work fine until I added another piece of code to the
forms 'Current' event. The code on the form's current
event changes the value in the combo box to Null after
the search has been performed so that database users are
not confused about which record they are on. At the
moment to find a record I have to use the combo box
twice. The first time removes the filter and the second
time finds the record, but what I really want to be able
to do is do it all in one action.
If any one can suggest a different way to clear the
value from combo box after the combo box has done its job
or a different way to remove the filter so that the combo
box can perform its search in one action thanks in
advance. (See code below)
This(below) is the code attached to the combo box's after
update event
Private Sub cboFindLocation_AfterUpdate()
' Find the record that matches the control.
If Me.FilterOn Then
Me.FilterOn = False
End If
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[LocationID] = " & Str(Nz(Me!
[cboFindLocation], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
This(below) is the code attached to the form's current
event
Private Sub Form_Current()
Me.cboFindLocation = Null
End Sub