I've got a form that builds a query. I need to run a report (already built) based on this query (the same query fields but different conditions) by clicking a button on the form. I can't just pass the filter because its too long and access throws a fit.
Originally posted by Toby Sand
Use the docmd.openreport, then pass on the where condition or the filter.
Well, thats how I have it working right now.. it doesn't work all the time. Sometimes the queries are pretty complex and access gives me an error saying that the filter is too complicated. I'm working with a large amount of fields here and over 10000 records, I need to limit my records before I open the report, not just filter them afterwards.
I'm working on something right now using VBA and creating a report object.. I'm a c++/java guy though and my skills with VB are pretty rusty. Any help would be appreciated.
"Sometimes the queries are pretty complex and access gives me an error saying that the filter is too complicated"
If your query sequence becomes to complex, consider to put a make-table query somewhere inbetween.
Then proceed with a new query based on your temp table.
Gives Access a much easier query schedule to execute.
Well, I've reworked a lot of it now. I'm trying to populate my temp table now using INSERT INTO. I'm doing this now because the query takes a while to execute and the user is going to use the data for several reports at a time.
I'm getting an error when I make the query, "Resultant table not allowed to have more than one autonumber field." when I do so. The query is quite complex (being built off of multiple queries which are built of multiple queries). I built my temp table with matching fields for the query. Two of the fields in the query show up as autonumbers but I made the temp table use regular number fields instead.