Combo Box Filter

  • Thread starter Thread starter TR
  • Start date Start date
T

TR

i have a form that is used for data entry. employees use the form to bring up
records. there are 2 combo boxes on the form to filter for specific records
in a Time Zone and particular Segment.

The underlying table as records - but 2 groups. Current and New.

I have a button on the form that can bring up the current group or the new
group. each are based on queries used as filters.
however, i only want employees to work on current group records.

the problem: when the employees are in the current group and use the combo
boxes for a specific time zone and segment the form shows both current and
new event though the current was filtered previously.

make sense? i don't know what i'm doing wrong. The event procedure for the
combo boxes is as follows and is on the AfterUpdate.
Option Compare Database

Private Sub Combo143_AfterUpdate()
Me.Filter = "[Segment Type] like '" & Me.Combo151 & "'" & " and [Time Zone]
like '" & Me.Combo143 & "'"

Me.FilterOn = True
End Sub

Private Sub Combo151_AfterUpdate()
Me.Filter = "[Segment Type] like '" & Me.Combo151 & "'" & " and [Time Zone]
like '" & Me.Combo143 & "'"

Me.FilterOn = True
 
TR -

It sounds like you are changing filters with both a button (for New or
Current) and with combo boxes. You need to include the 'Current' criteria in
your filter, something like this (use your group field name):

Private Sub Combo143_AfterUpdate()
Me.Filter = "[Segment Type] like '" & Me.Combo151 & "'" & " and [Time Zone]
like '" & Me.Combo143 & "' AND [group] = 'Current'"

Me.FilterOn = True
End Sub

I used 'Current' because you said you want employees to only work on Current
group records. If you want to allow the same filtering for 'New' records,
then I would suggest changing the button to an option group where the user
selects either New or Current, and Current is the default option. Then you
can update your filter to select 'Current' or 'New' based on the radio button
selected (the value of the option group).
 
Back
Top