Re: Are Report Commands Modal? by Jeff
Jeff
Wed Jan 28 16:11:30 CST 2004
Hello Eric,
Thanks for the reply. I over simplified the example a little but to answer
your question about why I use the scan loop:
My users are processing transactions for a variety of clients. When they are
done I need print a report for each client showing the processed
transactions. I need two copies of the report and they should be together. I
do the following:
SELECT DISTINCT CLIENTCODE FROM TRANS WHERE PROCESSED INTO CURSOR CLIENTLIST
&& TO GET A LIST OF CLIENTS
SELECT CLIENTLIST
SCAN
* GET TRANSACTIONS FOR CLIENT
SELECT * FROM TRANS WHERE CLIENTCODE = CLIENTLIST.CLIENTCODE AND
PROCESSED INTO CURSOR CLIENTTRANS
SELECT CLIENTTRANS
REPORT FORM TRANSREPORT TO PRINT NOCONSOLE && FIRST COPY
REPORT FORM TRANSREPORT TO PRINT NOCONSOLE && SECOND COPY
SELECT CLIENTLIST
ENDSCAN
This code which is contained in a separate PRG is still a little simplified
from the production code but not much. As I said before I get the following
strange results:
1. Run from menu on form with private data session The first report
(for the first client) gets the Variable Not Found error every time
2. Same as above but with the debugger running Works every time
3. Run from a button on a form with private data session Seems to work
4. Run from menu on form with default data session Works most of the
time
5. Run from the command box in the IDE Seems to work
I am currently using option number 4 in my production code and it is failing
once in a while. The failure rate is so low (about 1 out of 10) that I can't
really say that options 2, 4, and 5 which seem to work wouldn't also fail 1
out of 10 times.
Just to be complete about the description everything is built using VFP 7.0
SP1
The need for two sequential copies of the report is the reason that I didn't
use the method you outlined.
Thanks again.
Jeff
"Eric den Doop" <ericdendoop@xspamblockxfoxite.com> wrote in message
news:OJ4%23tDd5DHA.1428@TK2MSFTNGP12.phx.gbl...
> Hello, Jeff!
>
> I don't see anything in the code that could raise the Variable Not Found
> error. It must be a textbox or some kind of expression in your report if
you
> ask me. When I run into problems like this, I do the following:
>
> - run SQL to retrieve required data
> - open report file in report designer
> - from within the report designer, send the report to a print preview
>
> If you're lucky (and you probably are), the report designer will open the
> faulty field/expression in the Expression dialog box.
>
> Just another thing. Why are you running this report in a SCAN loop?
Wouldn't
> it be easier to create a grouped report? The first step is to combine the
> SCAN and the SQL:
>
> SELECT invoices.*, clients.required_fields ;
> FROM INVOICES ;
> WHERE invoices.CLIENTNUM = CLIENTS.CLIENTNUM ;
> INTO CURSOR CLIENTINVOICES
> IF _tally > 0
> REPORT FORM INVOICEREPORT TO PRINTER NOCONSOLE
> ELSE
> * no data to print
> ENDIF
>
> Just a thought.
> --
> Eric den Doop
> www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8
>
>