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!

CanGrow fields 1

Status
Not open for further replies.

MartinF

Technical User
Sep 19, 2000
143
0
0
FR
Hi,

I have a report that i want to display as a grid. The problem is is that the fields have to grow to accomodate various amounts of data, but then they all end up with different heights.

Is there any way that i can get them all to grow to the size of the biggest one irrespective of how little data is in the field

Thanks.
 
I have the same problem all the time and do not believe Access can handle growing grid.

What I do is that I use textboxes with transparent borders and use lines to make grid. Since lines can not grow either, I end up with plenty of blank space and some broken vertical lines in my report.

I would really appreciate it if someone can solve this problem.

Seaport
 
Seaport,

Just figured it!

For each box on the line set the tag field to: "ReqBox"

Then add this code to the On-Print of the section:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim Ctl As Control, Ht As Integer
Ht = 0

For Each Ctl In Me
If Me(Ctl.Name).Height > Ht Then
Ht = Me(Ctl.Name).Height
End If
Next

For Each Ctl In Me
If Me(Ctl.Name).Tag = "ReqBox" Then
Me.DrawWidth = 3
colour = RGB(0, 0, 0)
x1 = Me(Ctl.Name).Left
y1 = Me(Ctl.Name).Top
x2 = x1 + Me(Ctl.Name).Width
y2 = y1 + (Ht - 1)
Me.Line (x1, y1)-(x2, y2), colour, B
End If
Next
End Sub

This goes through each box on the line, records the height of the highest one, then draws a rectangle around each box on the line that has "ReqBox" in the tag field, to the height of the highest box.

Seems to work quite well
 
Or, put the horizontal lines in yourself and draw the vertical lines in code

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Me.ScaleMode = 1
Me.ForeColor = 0
'Repeat the following line of code for each vertical line
' 1*1440 represents 1 inch
Me.DrawWidth = 1

Me.Line ((1 / 2.54) * 1440, 0)-((1 / 2.54) * 1440, 1440)
Me.Line ((8.783 / 2.54) * 1440, 0)-((8.783 / 2.54) * 1440, 1440)
Me.Line ((12 / 2.54) * 1440, 0)-((12 / 2.54) * 1440, 1440)
Me.Line ((14 / 2.54) * 1440, 0)-((14 / 2.54) * 1440, 1440)
Me.Line ((16 / 2.54) * 1440, 0)-((16 / 2.54) * 1440, 1440)

End Sub

It works well, just a bit fiddly sorting out where the lines ought to be. You can see I have them at 1, 8.763 , 12, 14 and 16 cm
 
Martinf
Your solution is very elegant.
I had the same problem, and had been living with the constraints of a fixed height grid.Now I'm liberated from that constraint!
Thanks
Tigi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top