S
Sandy
I have a form with a subform. The subform has a pivot chart frm as its
source object. On the main form I have a number of controls that allow the
user to specify the criteria for the query of my pivotchart. A command
button initiates a requery of the pivotchart. The controls are two list boxes
(allowing muliselection) and three text boxes. When the text boxes are
updated a VBA sub updates a global variable. When the list boxes are updated
a VBA sub creates a global string is built based on the selection the user
makes or doesn't make. ( I got this bit from Mr Allen Browne on this forum)
To access the global variables in the query I have used simple functions
The txt box stuff works fine but it get complicated with the multiselect
list boxes
Say the function is called SetMyCriteria.
I have set the criteria in the query as
SetMyCriteria() OR Like ( IFF(SetMyCriteria() = "*", "*","")
This gives me the following based on how many if any the user selects
"*" or like "*" which gives all results when the use has
not selected OK
"sarms" 0r Like "" which the user selects only one persons id - ok
"IN ('sarms','abart')" or Like "" which gives me zip instead of all the
records for sarms and abart
I tried
IN (SetMyCriteria()) OR Like ( IFF(SetMyCriteria() = "*", "*","")
and changing SetMyCriteria = "'sarms','abart'" but no luck
I think I have decided this way is impossible but I'm not sure what my other
options are. This chart will be featured in other froms as well so I was
trying to find a tidy non repetive approach to being able to requery it from
different reports and forms. Any Ideas? I am a long time reader of the forum
but a first time poster.
source object. On the main form I have a number of controls that allow the
user to specify the criteria for the query of my pivotchart. A command
button initiates a requery of the pivotchart. The controls are two list boxes
(allowing muliselection) and three text boxes. When the text boxes are
updated a VBA sub updates a global variable. When the list boxes are updated
a VBA sub creates a global string is built based on the selection the user
makes or doesn't make. ( I got this bit from Mr Allen Browne on this forum)
To access the global variables in the query I have used simple functions
The txt box stuff works fine but it get complicated with the multiselect
list boxes
Say the function is called SetMyCriteria.
I have set the criteria in the query as
SetMyCriteria() OR Like ( IFF(SetMyCriteria() = "*", "*","")
This gives me the following based on how many if any the user selects
"*" or like "*" which gives all results when the use has
not selected OK
"sarms" 0r Like "" which the user selects only one persons id - ok
"IN ('sarms','abart')" or Like "" which gives me zip instead of all the
records for sarms and abart
I tried
IN (SetMyCriteria()) OR Like ( IFF(SetMyCriteria() = "*", "*","")
and changing SetMyCriteria = "'sarms','abart'" but no luck
I think I have decided this way is impossible but I'm not sure what my other
options are. This chart will be featured in other froms as well so I was
trying to find a tidy non repetive approach to being able to requery it from
different reports and forms. Any Ideas? I am a long time reader of the forum
but a first time poster.