Filtered field goes blank

O

Opal

I am trying to filter records in a form using two combo boxes
with the following in the after update event of each:

If IsNull(Me.cboFilter1) And IsNull(Me.cboFilter2) Then
Me.FilterOn = False
Exit Sub
End If

If IsNull(Me.cboFilter2) Then
Me.Filter = "AreaID = " & Me.cboFilter1
Me.FilterOn = True
Else
Me.Filter = "AreaID = " & Me.cboFilter1 & _
" and EquipmentNameID = " & Me.cboFilter2
Me.FilterOn = True
Exit Sub
End If

However, when I select cboFilter1 my EquipmentNameID
field goes blank and I cannot figure out why? Does anyone
have any suggestions? The filter works fine, by the way,
just a blank box.
 
R

Rick Brandt

Opal said:
I am trying to filter records in a form using two combo boxes
with the following in the after update event of each:

If IsNull(Me.cboFilter1) And IsNull(Me.cboFilter2) Then
Me.FilterOn = False
Exit Sub
End If

If IsNull(Me.cboFilter2) Then
Me.Filter = "AreaID = " & Me.cboFilter1
Me.FilterOn = True
Else
Me.Filter = "AreaID = " & Me.cboFilter1 & _
" and EquipmentNameID = " & Me.cboFilter2
Me.FilterOn = True
Exit Sub
End If

However, when I select cboFilter1 my EquipmentNameID
field goes blank and I cannot figure out why? Does anyone
have any suggestions? The filter works fine, by the way,
just a blank box.

If your form allows new records to be inserted then any filter that matches
zero rows will only show the new record position where any controls that
don't have default values will appear blank. My guess is that this is what
is happening.
 
J

Jan Baird

Jan Baird is out of the country until September 20. Every effort will be
made to respond to messages, but please be patient.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top