Inserting blank lines to an Access report (1 Viewer)

tf-nitrof

New member
Local time
Today, 06:11
Joined
Jun 1, 2013
Messages
5
Hi everyone,

I have a specific form, paper version, that I'd like to reproduce in an Access report. This form, which has 34 blank lines in the paper version, is used when people need to borrow some Tools or Equipment on a short period of time.

My report is made up in Access, but, if a person signs for, lets say, three different piece of Equipment, once it is sent to the printer, it prints three lines, which are the equipement signed for and it leave a big empty space before it reach the page footer.

What I need is something that will fill that empty space with blank lines. I found the following on the Net which meets my needs up to a point. What I mean is once it print the last line, it keeps on printing the last line until it meets the total count of 34 lines.

Here what I found on the Net: (note that I have a =count(*) into the Group Header)

Option Compare Database 'Use database order for string comparisons
Option Explicit

Global TotCount As Integer

' Call the SetCount() function from the group header section's
' OnPrint property using the syntax: =SetCount(Report)

' Call the PrintLines() function from the detail section's OnPrint
' property using the syntax: =PrintLines(Report,[TotGrp]).

Function PrintLines(R As Report, TotGrp)
TotCount = TotCount + 1
If TotCount = TotGrp Then
R.NextRecord = False
ElseIf TotCount > TotGrp And TotCount < 34 Then
R.NextRecord = False
R![NSN].Visible = False
End If
End Function

Function SetCount(R As Report)
TotCount = 0
R![NSN].Visible = False 'True
End Function



I submitted an attach file (blank_lines.gif) to show you what I end up with.

Thanks to anyone in helping me out on this one! :eek:


Stéphane
 

Attachments

  • blank_lines.gif
    blank_lines.gif
    8.1 KB · Views: 182

Cronk

Registered User.
Local time
Today, 20:11
Joined
Jul 4, 2013
Messages
2,772
As much as I try to avoid using temporary tables, sometimes it's more expedient/effective to do so.

In your case, determine the number of lines you want to print. Let's say it's 30. Make a table with 34 records and populate the first 30 rows. The last 4 lines will be blank.

If you've got more than 34, make the table with 68, 102, whatever records.
 

Mihail

Registered User.
Local time
Today, 13:11
Joined
Jan 22, 2011
Messages
2,373
What I mean is once it print the last line, it keeps on printing the last line until it meets the total count of 34 lines.
Subtract the number of lines with data from 34
 

tf-nitrof

New member
Local time
Today, 06:11
Joined
Jun 1, 2013
Messages
5
I guess you can call me stubborn cause I found the solution to my problem by playing around with this part of the coding:

I just had to add two other lines in the code to hide the two colunms that were displaying 'til the end of the report, which you'll find in red:

If TotCount = TotGrp Then
R.NextRecord = False
ElseIf TotCount > TotGrp And TotCount < 34 Then
R.NextRecord = False
R![NSN].Visible = False
R![Descripttion].Visible = False
R![Qte].Visible = False

End If
End Function



Cronk and Mihail, despide your input didn't quite answer to solve my problem, it sure had me digging further more into my quest. And for that, I thank you! Cheers! :)
 

Users who are viewing this thread

Top Bottom