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

Report and empty lines

Status
Not open for further replies.

Toman

Technical User
Mar 30, 2004
190
CZ
I have a report with "like table" design. Data are surrounded with rectangular and items are separated with horizontal line. After EOF() I want the table to continue to the end of page (with empty boxes).

What I need What I get
IWant.gif
IGet.gif


Any suggestion?
Thank you.
Tom
 
Hi Tom,

How about append blank records (as many as you need) to fill the page ?


-- AirCon --
 
My report is something like a telephone directory. It has data grouping according a first letter in one field, so just adding blank records can't work.
I can imagine using your idea when report would be called repeatedly with every group of data, but that leads to lot of code and is not elegant at all.
Thank for your answer. Tom
Any other idea?

 
Tom,

That's the first thing that came to my mind. Well, how about make a UDF and check for EOF() ?


-- AirCon --
 
AirCon's idea can work fine with just a few modifications.

Put your table into a Cursor by using a SQL Query and run your Report from the records within the Cursor. At the same time you create the Cursor, add a new field which will be used to control the Report Groups. This new field will not itself be printed, but will control the Report Groups.

In that way you can put whatever in that new (non-printed) field is necessary so that the data filled records will print as you want and the additional blank records will also print as desired.

Good Luck,
JRB-Bldr
 
Hi, jrbbldr
If I get you well, you mean something like that:
Code:
****************************************************
* Program to modify table for certain type of report
****************************************************
LinesPerPage = 20						&& must be set according to actual design of report

										&& "primary" sorting and adding 
										&& a temporary new field to original table
										&& invisible in report but serving for grouping 
SELECT NameField, OtherField, left(NameField,1) AS TmpField ;
	FROM MyTable ;
	ORDER BY TmpField, NameField ;
	INTO CURSOR tmp
COPY TO tmp1							&& cursor isn't updatable
GO TOP									&& pointer is bottom after a copy
DO WHILE NOT EOF()						&& examine all records
	lnCounter = 0						&& clear counter for every letter
	lcTmpField = TmpField				&& now only recs with this letter
	DO WHILE TmpField = lcTmpField
		lnCounter = lnCounter + 1		&& count them
		SKIP
	ENDDO
										&& add "blank" recs, but only when needed
	IF MOD(lnCounter,LinesPerPage) <> 0	
		FOR n = 1 TO LinesPerPage - MOD(lnCounter,LinesPerPage)
			INSERT INTO tmp1 (TmpField) VALUES (lcTmpField)
		ENDFOR
	ENDIF
ENDDO
										&& orig. tmp not needed any more,
										&& so can use it again
SELECT namefield, otherfield, tmpfield ;
	FROM tmp1 ;
	ORDER BY tmpfield ;
	INTO CURSOR tmp
REPORT FORM MyForm NOCONSOLE PREVIEW	&& that's it

It really works fine, thank you. Any further suggestions how to improve a code are welcome
Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top