creating a combo box that filters a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to create a combo box that filters a form

Filter:
Active
All
Inactive

I have a true/false field for active/inactive items

Thanks for any and all help!
 
Since you have a fixed and small range of choices, you could also use an
option group (radio buttons) to select which set of records to display. Use
the tool wizard to create an option group, then and something like below to
the option group control's AfterUpdate event:

Private Sub FilterGrp_AfterUpdate()
'Apply filter button choice
If FilterGrp = 2 Then
Me.Filter = "[myField]=0"
Me.FilterOn = True
ElseIf FilterGrp = 1 Then
Me.Filter = "[myField]=-1"
Me.FilterOn = True
Else
Me.FilterOn = False
End If
End Sub

-Ed
 
Sweet!, I'm not a VB person but I figured what to change to fit my db and it
works! and that is awesome!
--
Chris Hayes
Newby


Ed Robichaud said:
Since you have a fixed and small range of choices, you could also use an
option group (radio buttons) to select which set of records to display. Use
the tool wizard to create an option group, then and something like below to
the option group control's AfterUpdate event:

Private Sub FilterGrp_AfterUpdate()
'Apply filter button choice
If FilterGrp = 2 Then
Me.Filter = "[myField]=0"
Me.FilterOn = True
ElseIf FilterGrp = 1 Then
Me.Filter = "[myField]=-1"
Me.FilterOn = True
Else
Me.FilterOn = False
End If
End Sub

-Ed
 
Back
Top