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

Add blank lines to a report for a grid look

Status
Not open for further replies.

dmeyers

Technical User
Jan 17, 2007
2
US
I have a Access purchase order report that may have only a couple of records to print. The records are formatted to print borders for each record creating a grid look. I would like to fill the remainder of the report page with blank records displaying the grid lines.

Got any ideas?


 
A bit cumbersome, but we do it with the line method in code.
The following example prints just a few lines - doa help search on the method to find out how to do boxes, vertical lines, etc.:

Code:
Private Sub Report_Page()
    
    lngBackColor = 0       'Dimmed as long in declarations
    Me.ScaleMode = 5       'ScaleMode 5 = inches
    
    Me.Line (0.05, 3.8)-(10.25, 3.8), lBackColor
    Me.Line (0.05, 4.6)-(10.25, 4.6), lBackColor
    Me.Line (0.05, 5.4)-(10.25, 5.4), lBackColor
    Me.Line (0.05, 6.2)-(10.25, 6.2), lBackColor
     
End Sub


Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.
 
I am using microsoft access 2000 and i want to print a report from two recordset (tables) the report would essentially be aam employee's payslip and should look like this:

Salaries xxxxxxxx NIS xxxxxxx
Travel xxx PAYE xxxx
Entertain xxx

Total xxxxxxx xxxxxx

Net Pay xxxxxxx

The report is to be printed on a preprint paper so it must have the same amount of records per page. Can you help? The two tables are link by an employeecode. the three tables are earnings,deductions and employees.
 
dmeyers
If you want to make a grid so that it looks like a spreadsheet, you can adapt the following and put it in the Page event for your report.

Code:
Private Sub Report_Page()
Dim intI As Integer
Dim intJ As Integer
Dim intHeight As Integer
Dim intTop As Integer
Dim intLeft As Integer
Dim intWidth As Integer
intHeight = Me.Detail.Height
For intJ = 3 To 28
    For intI = 1 To 7
    intLeft = Me("text" & intI).Left
    intTop = intJ * intHeight
    intWidth = Me("text" & intI).Width
    Me.Line (intLeft, intTop)-Step(intWidth, intHeight), , B
    Next
Next
    
End Sub

intJ is enumerating the total number of lines you want down the page. In the example above, the grid starts at the 3rd line in the Detail section and goes to line 28.

intI is the number of fields horizontally across the page.

In this case, I named each of the text boxes that hold data from the fields text1, text2, text3 and so on.

Tom
 
dewildpup
It's best to make a new post. Putting it in on another post generally means it gets overlooked.

Tom
 
Thanks Watson,

I will let you know how it goes but I was thinking more of using a record set to build a table of the payslip and then using a report to display it. Since it will be printed on a preprinted payslip I would need to fill in the remainder with dummy lines so that the totals print in the correct place. I started a new post you can reply to that one instead.

Thanks very much.

Dewildpup
 
Thanks to everyone for your advice. In the end I went with a mail merge w MicoSoft Word since I had a report format restriction.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top