B
Brad Pears
I have an Access 2000 application where the user can select a multiude of
criteria to produce a report. When the user clicks the 'Print' button, I
then build a dynamic SQL statement based on the criteria selected.
I just had to add some additional criteria selection to the report at the
users request, but unfortunately it will now be possible for them to choose
so many different criteria, that my SQL statement can exceed the maximum
size as far as number of characters in the actual statement. At least I am
assuming that is what I am having the problem with - as that is what is
indicated in the error message I receive. I had read somewhere some time ago
that there is a max characters for an SQL statement.
Basically the critera is a bunch of list boxes filled with options. In each
of the listboixes, the user can select multiple items to report on. For some
of the listboxes, they may want to report on ALL of the items in there. So,
when I build my dynamic SQL statement, I am looping through all selected
items in each of the listboxes and building a where claused based on each
item selected.
This must obviously be a problem for other people as well. What is the best
way to overcome the problem? I was thinking about building a base SQL
statement, then build multiple where clauses (one for each of the list box
selections) - each one based on the previous query and in the end I would
only have the records I want - but what would be the best way to do that?
Can you think of any other way to do this at all???
Thanks, Brad
criteria to produce a report. When the user clicks the 'Print' button, I
then build a dynamic SQL statement based on the criteria selected.
I just had to add some additional criteria selection to the report at the
users request, but unfortunately it will now be possible for them to choose
so many different criteria, that my SQL statement can exceed the maximum
size as far as number of characters in the actual statement. At least I am
assuming that is what I am having the problem with - as that is what is
indicated in the error message I receive. I had read somewhere some time ago
that there is a max characters for an SQL statement.
Basically the critera is a bunch of list boxes filled with options. In each
of the listboixes, the user can select multiple items to report on. For some
of the listboxes, they may want to report on ALL of the items in there. So,
when I build my dynamic SQL statement, I am looping through all selected
items in each of the listboxes and building a where claused based on each
item selected.
This must obviously be a problem for other people as well. What is the best
way to overcome the problem? I was thinking about building a base SQL
statement, then build multiple where clauses (one for each of the list box
selections) - each one based on the previous query and in the end I would
only have the records I want - but what would be the best way to do that?
Can you think of any other way to do this at all???
Thanks, Brad