G
Guest
I have a multi-select listbox with filter criteria in it (say, customer_type)
Based on the selection(s), I'd like to make an unbound listbox show only
those records that satisfy such selected criteria. Now I know one way to do
this is to construct an sql statement based on filter criteria and use it as
rowsource for the listbox, but this appears to be not quite optimal. The way
I'd rather have it is to specify the condition in the query builder at design
time via a variable (i have the function specified as the condition in the
querybuilder which returns the variable). This causes type mismatch, though.
Table: Customers
Fields: ID, Name, customer_type (int)
The condition expression is, for example, "1 or 6 or 12".
If i enter it into the query builder for listbox's rowsource at design time,
it works. But if i enter it in quotes, it obviously doesn't, and i guess as
the condition string is being constructed while parsing the multiselect
listbox and stored in a string variable, which in turn is handed via a
function to the Rowsource, it is in these "quotes" where the problem lies. Is
there a way to convert this type somehow, for i don't want to code the line
to produce ...WHERE (((Customers.ShipmentMethod)=1 Or
(Customers.ShipmentMethod)=6 Or (Customers.ShipmentMethod)=12))... type of
statement. Thank you in advance!
Based on the selection(s), I'd like to make an unbound listbox show only
those records that satisfy such selected criteria. Now I know one way to do
this is to construct an sql statement based on filter criteria and use it as
rowsource for the listbox, but this appears to be not quite optimal. The way
I'd rather have it is to specify the condition in the query builder at design
time via a variable (i have the function specified as the condition in the
querybuilder which returns the variable). This causes type mismatch, though.
Table: Customers
Fields: ID, Name, customer_type (int)
The condition expression is, for example, "1 or 6 or 12".
If i enter it into the query builder for listbox's rowsource at design time,
it works. But if i enter it in quotes, it obviously doesn't, and i guess as
the condition string is being constructed while parsing the multiselect
listbox and stored in a string variable, which in turn is handed via a
function to the Rowsource, it is in these "quotes" where the problem lies. Is
there a way to convert this type somehow, for i don't want to code the line
to produce ...WHERE (((Customers.ShipmentMethod)=1 Or
(Customers.ShipmentMethod)=6 Or (Customers.ShipmentMethod)=12))... type of
statement. Thank you in advance!