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
 

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

Similar Threads


Back
Top