Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print one file then another

Status
Not open for further replies.

Polly66

Programmer
Nov 3, 2001
42
AU
Hello everyone,

I am new to VFP(9) reports and don't think that this can be done, but better to ask than live in ignorance.

What I would like to do is print a report with information from two files (not exactly the same structure, so an append won't work). With the total of one file printed first before the second is started. I also want the report to appear as one entity on the same page, as if there is no join. The content of both files would need only to be one page in total.

Thanks if anyone can advise, even a no, it can't be done, if that is the case would be appreciated.

Bill Shepherd
 
You can always try something like the following

Code:
* -- Create New Temporary Table From Table1 And Extra Field to support Table2 ---
* --- New Temp Table has only Table1 records meeting WHERE criteria ---
* --- Modify accordingly to meet Table2 field requirements ---
SELECT Table1.*,;
    SPACE(10) AS Tbl2Fld1,;
    SPACE(20) AS Tbl2Fld2,;
    1000 AS Tbl2Fld3,;
    DATE() AS Tbl2Fld4,;
    .F. AS Tbl2Fld5;
  FROM Table1;
  WHERE <whatever>;
  INTO TABLE TempDBF

* --- Now TempDBF Has all desired fields from Table1 ---
SELECT TempDBF

* --- Add New Records From Table2 ---
SELECT Table2
SCAN FOR <whatever>
   SCATTER MEMVAR

   SELECT TempDBF
   APPEND BLANK
   GATHER MEMVAR

   SELECT Table2
ENDSCAN

* --- You might have to fill in empty fields in some records to get report as desired ---
SELECT TempDBF
REPLACE ALL Country WITH "USA" FOR EMPTY(Country)  && merely an example

* --- Print Report From TempDBF ---
SELECT TempDBF
GO TOP
REPORT FORM MyReport TO PRINTER

* --- 'Clean House' ---
SELECT TempDBF
USE
ERASE TempDBF

Good Luck,
JRB-Bldr
 

Hi JRB-Bldr,

Thanks for the suggestion. I already was using a temporary file for layout reasons, but this is another angle to work on. Thank you for your time.

Regards

Bill
 

Hi Mike,

Thanks again for your informative advice. I hadn't thought of the noeject command, but that is a good tip to keep in mind.

Regards

Bill
 

Mike,

Where is this NOPAGEJECT command. I can't find any reference to this anywhere, only to EJECT. Also, would I in my prg file have:

report form 1
NOPAGEJECT
report form 2

Bill

 
Bill

What version of VFP are you using? I see it in VFP9.0 and VFP8.0. The format is

Code:
REPORT FORM myReport1.frx TO PRINTER NOPAGEEJECT




Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Hi Mike & Mike,

Thank you for your knowledge and time.

Bill
 
JRB-Bldr is pointing you in the right direction, but you don't need to use a loop for this. Use the UNION clause of SELECT to create one large query that sets up the data in the order you want to report on it.

You'll find an example of this sort of query on my website in this article:


Look for the section titled: Multiple unrelated siblings redux – multiple detail bands

Tamar
 
Hi Tamar,

Thank you for your advice and reference info provided on your terrific website. Sorry that I have not replied earlier but I have been out of town.

Regards
Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top