M
Mark Andrews
I have an Access 2007 database where I let users use the built-in filtering
from the datasheet portion of a split screen form.
Example: The user might have 10,000 accounts and they filter the list to
show 4,000 from 5 different cities.
I give the user and option to for example print labels for these 4,000
filtered accounts.
My first approach was as follows:
- build a where clause string as a giant IN clause for all 4,000
- pass this to the report as a where clause using open report
works fine until the where clause gets to be too many characters then fails.
Second and current approach is as follows:
- build a query via code (querydef etc..) that returns accountid and uses a
giant IN clause
- join this query to the query which drives the report
- NO where clause is passed in on opening of the report
works fine. The only weird behavior is if I try and open the "qryFilter" in
design mode Access 2007 gives an error:
Assertion failed line 49 of safeops.cpp
So basically crashing the Access program itself
Also might be a tab slow (due to the giant IN clause).
My issue with building the filter for the report (based on the filter
specified on the datasheet) is if you use combo boxes
in the datasheet with the first column hidden (such as a normal combo for a
parent record (ID, ParentName)) and then look at the filter it
kind of makes up it's own sql "queryname.[visible field in combo] (event
though that field is not in the query itself).
So for my initial example I am making labels for all accounts in 5 different
states and the filtering criteria is simple and changing it to
an IN with 4000 account ids doesn't seem to be the right solution. However
I might have 7 comboboxes that really represent
additional tables that are related and I didn't want to have to write a
bunch of code to transform the filter (especially if I do this on multiple
datasheets).
Note: My datasheet can also be used for entering data so I need to keep the
comboboxes etc....
Question is what is the right approach to allow users to do things like make
reports off a filtered list of items
While Relying on the built-in Access datasheet filtering options?
Hoping someone has tackled this one.
Thanks,
Mark
from the datasheet portion of a split screen form.
Example: The user might have 10,000 accounts and they filter the list to
show 4,000 from 5 different cities.
I give the user and option to for example print labels for these 4,000
filtered accounts.
My first approach was as follows:
- build a where clause string as a giant IN clause for all 4,000
- pass this to the report as a where clause using open report
works fine until the where clause gets to be too many characters then fails.
Second and current approach is as follows:
- build a query via code (querydef etc..) that returns accountid and uses a
giant IN clause
- join this query to the query which drives the report
- NO where clause is passed in on opening of the report
works fine. The only weird behavior is if I try and open the "qryFilter" in
design mode Access 2007 gives an error:
Assertion failed line 49 of safeops.cpp
So basically crashing the Access program itself
Also might be a tab slow (due to the giant IN clause).
My issue with building the filter for the report (based on the filter
specified on the datasheet) is if you use combo boxes
in the datasheet with the first column hidden (such as a normal combo for a
parent record (ID, ParentName)) and then look at the filter it
kind of makes up it's own sql "queryname.[visible field in combo] (event
though that field is not in the query itself).
So for my initial example I am making labels for all accounts in 5 different
states and the filtering criteria is simple and changing it to
an IN with 4000 account ids doesn't seem to be the right solution. However
I might have 7 comboboxes that really represent
additional tables that are related and I didn't want to have to write a
bunch of code to transform the filter (especially if I do this on multiple
datasheets).
Note: My datasheet can also be used for entering data so I need to keep the
comboboxes etc....
Question is what is the right approach to allow users to do things like make
reports off a filtered list of items
While Relying on the built-in Access datasheet filtering options?
Hoping someone has tackled this one.
Thanks,
Mark