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

Creating what looks and acts like a table, in a sub report.

Status
Not open for further replies.

jasonmac

Programmer
Nov 14, 2002
175
US
I have a subreport containing detail information about daily production. The report is first grouped by a sales order number and then by date. There are several fields in the detail line.

I would like this report to display much like a table in Microsoft Word would. I've tried drawing lines around my fields in the detail line. This works okay until one of the fields grows to show more data and then I get gaps at the bottom of the row.

I have also tried pushing the fields together and changing their border properties to "solid" but once again when a particular field grows the others do not grow with it.

Changing the grow property to "no" is not an option. I have to be sure that the information entered shows up on my report.

Is there a way to either create a table in the detail section of my report or is there some way I can make sure that the height of my fields change in unison?
 
You could use the Line method in the Report_Page section to draw vertical lines between fields. Then, add a horizontal Line control to your Report Detail section above all of the fields. Together, this will make the report look like a datasheet (or Word table with grid lines) while allowing the report fields to Grow or Shrink with the data.

For example:

Private Sub Report_Page()
' Draw a border around each page before printing
Me.ScaleMode = 5
Me.DrawWidth = 8
Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), , B

' Draw lines between each of the columns before printing
Me.DrawWidth = 2
Me.Line (0.54, 2)-(0.54, 10.5)
Me.Line (1.39, 2)-(1.39, 10.5)
Me.Line (3.31, 2)-(3.31, 10.5)
Me.Line (3.85, 2)-(3.85, 10.5)
Me.Line (4.39, 2)-(4.39, 10.5)
Me.Line (5.18, 2)-(5.18, 10.5)
Me.Line (5.89, 2)-(5.89, 10.5)
Me.Line (6.68, 2)-(6.68, 10.5)
End Sub

The first set of code will draw a border around the page. The second set of code will draw vertical lines starting 2 inches from the top margin and ending 10.5 inches from the top margin.
 
Very close. However, since I only want the grid lines to appear in the detail section of the form I added the code to the "OnFormat" event of the detail section.

The border is working fine but the vertical lines are not working. I believe this is due to the specified length set forth in the code. I have changed the code so that the lined would be drawn in the correct spot on the form but nothing shows up.

I believe the problem is here:

Me.Line (0.79,2)-(0.79, 10.5)

Am I close? Is there a way to set the lengths of the line to stretch from the top of the detail section to the bottom of the detail section?
 
i think what u need to do is..you should make your form appears in a form that look likes a table..understand? and then..use it as a subform in your report...
using this..u can add as much field as u like..and it will apeared same as what u entered in your form.if u didnt understand.try e-mailling me.. chio..
may the force be with you..
 
hi again...maybe u should zip and attched your program to me.. and e-mail it to re24@hotmail.com ill try to do it for you..(i am using Ms Access 2000)
bye..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top