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

Gridlines in reports

Status
Not open for further replies.

Aoife

IS-IT--Management
Oct 19, 2000
9
0
0
IE
Is there any easy way of desiging a report so that the data will be displayed in tables, including the gridlines. I know that I could export the data to Excel, however I need to export it to Word instead so that headers and footers will be included?

Thanks in advance
 
here is some code that redraws existing vertical lines to accomodate textboxes that grow and shrink. It also draws horizontal lines.

Option Compare Database
Option Explicit
Dim lngPage As Long
' this code uses Lines set into the detail section
' that have their Visible property set to False.
' We redraw new lines in the same location that
' are slightly larger than the tallest TextBox
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim sngLineTop As Single
Dim sngLineLeft As Single
Dim sngLineWidth As Single
Dim sngLineHeight As Single
Dim ctl As Control
Dim lngH As Long
'if new page then draw a line at the top of the detail section
If lngPage <> Me.Page Then
Me.Line (0, 0)-Step(Me.Width, 0)
lngPage = Me.Page
End If
'get the height of the tallest TextBox
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If Me(ctl.Name).Height > lngH Then
lngH = Me(ctl.Name).Height
End If
End If
Next ctl
'draw a new line in the same spot as existing lines
For Each ctl In Me.Controls
If ctl.ControlType = acLine Then
sngLineTop = Me(ctl.Name).Top
'4320 twips equals 3 inches
sngLineLeft = Me(ctl.Name).Left
'20 twips equals approximately 1 point (1/72 inch)
sngLineWidth = Me(ctl.Name).Width
sngLineHeight = 0 + lngH + 10
Me.Line (sngLineLeft, sngLineTop)-Step(sngLineWidth, sngLineHeight)
End If
Next ctl
'draw a line at the bottom of the Detail Section
sngLineTop = lngH + 10
sngLineLeft = 0
sngLineWidth = Me.Width
sngLineHeight = 0
Me.Line (sngLineLeft, sngLineTop)-Step(sngLineWidth, sngLineHeight)
End Sub

PaulF
 
You are going to have a problem with getting the lines in Word. Saving an Access report in RTF format eliminates many drawn objects such as lines and checkboxes. In order to simulate lines, you need to use text characters such as the underscore (_) and vertical bar (|). Unfortunately, I can't help you any farther in using these characters. Hopefully someone else can.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top