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

How Can I Create a Vertical Line in an Access Report 3

Status
Not open for further replies.

AllenRitch

Technical User
May 20, 2003
52
US
Is there anyway to create multiple vertical lines (i.e. Columns) in an Access report. I realize I could use the Line tool, but that would make the lines constant in length. I'm needing something that would expand or shrink according to the size of detail for each row of data.

Any suggestions???
 
Well, this is VERY low tech (and not pretty at all), but you could include a pipe character (|) as part of your detail line(s).

< M!ke >
 
Thanks for the suggestion, but that would leave me with the same problem that the Line tool would. For the most part, each detail line (or row) is the same size in terms of height, but every so often, the detail line will increase in size. As a result, the pipe character or the Line tool would leave gaps down the page and I'm needing a line that would appear seamlessly.
 
#1 - Stephen Lebans has something called 'ReportUtilities' that has a package called 'DrawBoxes' or something like that. It will make an Excel-looking table out of an Access report, and it works even if one control needs to be able to grow (if you've run into this problem like me, you know, but if not, just ignore the whole 'growing' thing).


#2 - Other than that, you can just set a border around each of your controls in the Detail section, and make them fill the entire detail section, leaving no gaps between detail lines. This will generate something like what you need.

Try #2 (it's a quick thing to set up), then if that doesn't work, see about #1. You can google for #1 if necessary.
 
This is how I do it. I layout my report without the vertical bars and each column has a column heading. And the width of each column headings is at least the width of the text box. Actually, the left coordinate of the heading will be where the vertical line begins.

Now assume you have 3 controls on your report: txt1, txt2, and txt3 with corresponding column headins of lblHead1, lblHead2, lblHead3. Also assume that all 3 of the controls' "Can Grow" property is set to true. In the OnPrint event of the Details section do something like this:
Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

    Dim sngHt As Single

'*************************
'*  Draw Height of line  *
'*************************
    
    sngHt = txt1.Height
    If (txt2.Height > sngHt) Then sngHt = txt2.Height
    If (txt3.Height > sngHt) Then sngHt = txt3.Height
    
    sngHt = sngHt + (Me.Detail.Height - txt1.Height)
    
'*************************
'*  Draw vertical lines  *
'*************************

    Me.Line (lblHead1.Left, 0)-(lblHead1.Left, sngHt)
    Me.Line (lblHead2.Left, 0)-(lblHead2.Left, sngHt)
    
    Me.Line (lblHead3.Left, 0)-(lblHead3.Left, sngHt)
    Me.Line (lblHead3.Left + lblHead3.Width, 0)-(lblHead3.Left + lblHead3.Width, sngHt)

End Sub
NOTE that the following 2 lines draw a vertical line beginning at the left coordinate of the heading.

Me.Line (lblHead1.Left, 0)-(lblHead1.Left, sngHt)
Me.Line (lblHead2.Left, 0)-(lblHead2.Left, sngHt)

The 1st line of the next 2 lines draws a vertical line beginning at the left coordinate of the heading. The next line draws the vertical line beginning at the right side of the heading.

Me.Line (lblHead3.Left, 0)-(lblHead3.Left, sngHt)
Me.Line (lblHead3.Left + lblHead3.Width, 0)-(lblHead3.Left + lblHead3.Width, sngHt)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top