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

Determine which page a record is on (within a formulae) 1

Status
Not open for further replies.

TheOnlyBoxy

Technical User
Jul 5, 2004
8
0
0
GB
I have a report which is made of two reports, an Index report showing descriptions, and a main report with all grouped records, I want to be able to page number the index record to which the corresponding main record is on. Any help would be great.
 
I can only think of one way to do this. Assuming 1) that you have a fixed amount of space per record on the report view (I will assume 10 records per page) and 2) you add a field for "pagenumber" to the database and 3) you define variable type fields VarPNum and VarRecNum.

Macro 1:
- VIEW switch to a worksheet view of your database.
- FIND your set of records for the report.
- SORT them into the order for the report.
- SET VarPNum = 1
- SET VarRecNum = 1
- RECORDS First
- RUN macro 2 (and return to the next statement)
- now you can do your reports using the field "pagenumber" for the index.

Macro 2:
- SET "pagenumber" = VarPNum
- ENTER
- SET VarPNum = If(VarRecNum <= 10,VarPNum,VarPNum + 1)
- SET VarRecNum = If(VarRecNum = 10,1,VarRecNum + 1)
- RECORDS Next
- RUN Macro 2

What makes this work is that the RECORDS Next will end Macro 2 when it runs out of record in the current set.

Sue Sloan
XpertSS.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top