report getting records from a form without recalculating them

S

Sarah

I have a question about something that really bothers me about my
application. My form has a RecordSet that is computed using a reasonably
complex SQL statement woven together by code in the form's module. This
works just fine, but takes about 12 seconds. The continuous form always
shows exactly 5 records with 3 textboxes in each, for a total of 15.

Here's my question: The form has a button that allows me to print a report
showing the exact same 15 values as were in the form. Currently, my report
has the same RecordSet, so we go through the same 12s delay as values are
recalculated. What is the best way to simply copy the 15 values that are
already calculated in the form without recomputing them?

much thanks
 
C

Carl Rapson

You could save the results of the SQL statement into a temporary table, and
base the report on the temporary table.

Carl Rapson
 
S

Sarah

Carl - thank you for the reply. I'm quite new to all of this - could you
spell this out just a bit more, or point me to a suitable reference that
would give more detail?

thanks so much
 
C

Carl Rapson

Create a table with the same fields as the query (it's called temporary
because records are added on the fly and discarded when no longer needed).
After you've opened the recordset, copy each field in the recordset to the
same field in the table. Then, base the report on the table rather than on
the query. Whenever you load records to the table, be sure to delete any
existing records first (they would have been left over from a previous
instance of the form). It's a good idea to delete the records in the
temporary table in the Form_Close event also.

Carl Rapson
 
J

Jared

Hi Carl,

I have a similar situation whereby a form is populated by a complex recordset.

Is there a nice easy way to pass the recordset to a report for printing
purposes?

Thanks

Jared
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top