Filtered field goes blank

  • Thread starter Thread starter Opal
  • Start date Start date
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.
 
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.
 
Jan Baird is out of the country until September 20. Every effort will be
made to respond to messages, but please be patient.
 
Back
Top