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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Skipping problem

Status
Not open for further replies.

Bertiethedog

Programmer
Feb 8, 2007
118
GB
I don't think this is a report problem
but I have this bit of simple code

Code:
SELECT _tmp2
SET SKIP TO _tmp2

REPORT FORM orderacks TO PRINTER PROMPT PREVIEW

the report seemed to be skipping through the wrong table

With the set skip in place we get "_tmp2 is not related to the current work area"

_tmp2 is a cursor created with the create cursor command

Richard
 
SET SKIP TO ... is for when you have a table related into another table, and want to skip through records in the second table. Such as:
Code:
table_1         table_2
  record1           
      |             
      |-------- record1
      |-------- record2
       -------- record3
  record2
      |             
      |-------- record1
      |-------- record2
       -------- record3
  record3   
      |             
      |-------- record1
      |-------- record2
       -------- record3

If all you're trying to do is 'skip' through _tmp2 for each line in the report, REPORT FORM does that for you for the selected table, but not necessarily for the related into table.



-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Just to add to Dave's comments, you'd normally be in the parent work area when you issue SET SKIP TO.

That said, I almost never use tables and relations for reporting. Instead, I write a query that pulls out the data in the exact order and form I need it, and then report on the query.

Tamar
 
Hi so do I the cursor was created manually then had to be populated. The code to populate it is complex.

I then selected the cursor and ran the report, the set skip was desperation.


Regards


Richard
 
I have done VFP Reports with Parent/Child relations in 2 different ways.

Method 1:
Use a 'backwards' RELATION where the Child becomes the 'parent' in the relation and have the current workspace point to the Child table.

Set the relation up so that:
Child Record 1 ---> Parent Record 10
Child Record 2 ---> Parent Record 10
Child Record 3 ---> Parent Record 8
Child Record 4 ---> Parent Record 8
Child Record 5 ---> Parent Record 6

Then:
Code:
SELECT ChildDBF
GO TOP
REPORT FORM MyReport NOCONSOLE TO PRINTER

Method 2:
As has been suggested above, create a special cursor just to support report printing.

Code:
SELECT <Whatever Child fields>,;
   <Whatever Parent fields>;
  FROM Parent, Child;
  WHERE Child.KeyFld = Parent.KeyFld;
  AND <Whatever selection criteria desired>;
  INTO CURSOR RptCursor

SELECT RptCursor
REPORT FORM MyReport NOCONSOLE TO PRINTER

Good Luck,
JRB-Bldr
 
You won't believe this, the problem was in the report.

Many thanks to everyone that made suggestions


Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top