Connecting Tech Pros Worldwide Forums | Help | Site Map

Option Group Filtering - problem

Moe
Guest
 
Posts: n/a
#1: Feb 15 '06
Hi, this my first post to this group. I am trying to add a option
group of ture/false and all. This is on a form, that the results are
displayed in a subform. When the user select a record from the last
combo box, (I have three combo boxes that filter into the next), and
when the last is selected it shows results in the subform. Now I want
the optiongroup to further filter the data. So far I am not able to
get the option group to work. This is what I have in the afterupdate
of the last combobox. Any help is much appreciated.

Rene


Dim strSQL As String
Select Case grpFilter
Case 1 'yes
strSQL = "=1"

Case 2 'No
strSQL = "=0"

Case 3 'All
strSQL = "IN(-1,0)"

Me.subQryP.Form.Filter = "DugStatus" & strSQL
Me.subQryP.Form.FilterOn = True

End Select


Br@dley
Guest
 
Posts: n/a
#2: Feb 15 '06

re: Option Group Filtering - problem


Moe wrote:[color=blue]
> Hi, this my first post to this group. I am trying to add a option
> group of ture/false and all. This is on a form, that the results are
> displayed in a subform. When the user select a record from the last
> combo box, (I have three combo boxes that filter into the next), and
> when the last is selected it shows results in the subform. Now I want
> the optiongroup to further filter the data. So far I am not able to
> get the option group to work. This is what I have in the afterupdate
> of the last combobox. Any help is much appreciated.
>
> Rene
>
>
> Dim strSQL As String
> Select Case grpFilter
> Case 1 'yes
> strSQL = "=1"
>
> Case 2 'No
> strSQL = "=0"
>
> Case 3 'All
> strSQL = "IN(-1,0)"[/color]

That's redundant. Just leave it blank (ie. strSQL = "")

(unless you are dealing with Null values as well?)
[color=blue]
> Me.subQryP.Form.Filter = "DugStatus" & strSQL
> Me.subQryP.Form.FilterOn = True
>
> End Select[/color]

Not sure why it's not working. What happens, if anything, when you use it?
(ie. a better explanation then "it doesn't work" :)

Another way to do it woul be to just change the RowSouce of the form?

eg.

Me.subQryP.Form.RowSource = _
"Select * FROM myTable WHERE [DugStatus] = " & strSQL & ";"

--
regards,

Br@dley


Closed Thread


Similar Microsoft Access / VBA bytes