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!

Limit height of the detail section of access report

Status
Not open for further replies.

dewildpup

Technical User
Jan 26, 2007
45
BB
How do I make the detail section of a report the same height. I would like to print a report on a preprinted form the report holds a record per sheet(payslip) and the total are always printed in the same box. So if the report detailed section has two records I want it to print 6 blank records to make up so that the footer will always be in the same place. If the detailed section has 10 records the print 8 on the first page and put the other two on a second page with 6 blank line to make eight lines.
 
Do a help search on MoveLayout/NextRecord/PrintSection methods. There may be a faq or 2 floating around somewhere as well, just can't find it right now...

Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.
 
Forgot to add we use code to print a predetermined mnumber of "blank" lines (a difference of what printed and what the page can hold):
MoveLayout = True
NextRecord = False
PrintSection = True
But you will either need to set the controls in the detail section to be invisible, or their recordsources to be a blank space.

Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.
 
I try using the following code to print blank records after the last line in the detail section but it wouldn't work.

for r =Count to 8
MoveLayout = True
NextRecord = False
PrintSection = True
Next r

Regards
LeVere
 
Can't use it in a loop - has to go in the Detail_Print() event. When predetermined criteria is met, use the code to print a blank line each time this event fires:

If bolOutOfData And intLoopCounter <= (conMaxLines - intBlanksTarget) Then

etc....


Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.
 
Hi here is the problem i have to print maybe 5,6,1,4 blank lines. The amount is determine by the number of lines in the detailed section of the report and the remainder is made up by blank lines. So I need to loop or print more than 1 blank line at a time so be more specific.

Lets say for argument sake I wanted to print three blank lines. What event would I use as the trigger.


Thanks

Dewildpup
 
I am not sure about all your specifications since I don't know what a "blank record" should look like. I use code in the On Page event of the report to draw all the lines/boxes. If you "footer" is the page footer, it will always print in the same place.

Private Sub Report_Page()
Dim intNumLines As Integer
Dim intLineNumber As Integer
Dim intTopMargin As Integer
Dim ctl As Control
Dim intLineHeight As Integer
Dim intLineLeft As Integer
Dim intLineWidth As Integer
intNumLines = 8
intLineLeft = 720 '1/2 inch from left margin
intLineWidth = 1440 * 5 '5 inches
intTopMargin = Me.Section(3).Height
intLineHeight = Me.Section(0).Height
For intLineNumber = 0 To intNumLines - 1
Me.Line (intLineLeft, intTopMargin + _
(intLineNumber * intLineHeight)) _
-Step(intLineWidth, 0)
Next
End Sub

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
hi dhookom:

I tried your code but it is not giving me what i want.

I have a detail section footer (group footer) on EmployeeCode. An employee can have various earnings and deductions but the totals on the pay slip must always print on the same line. The payslip is a preprinted one with lines and boxes its about 4" down x 8" across.

I found that i can get the figures to print within the lines but the totals will not print where there are suppose to print because as the lines in the detail section change the report footer moves up and down the page.

Thanks

LeVere
 
I would then try to place the details in a subreport. You can set the size of the subreport to a fixed height. Make sure you remove the details from the record source of the main report.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks Dhookom,

I tried you subreport suggestion and it works fine.


Thanks agian!!!!!!!!!!!

LeVere
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top