How do I include a grid in Access Report

  • Thread starter Thread starter TimJames
  • Start date Start date
T

TimJames

I am generating an Access report based upon an existing hard copy form. The
form requires a grid to be drawn starting in the detail section and
continuing down the rest of the page, however not every "box" in the grid
will have information in it. Each row needs to have 7 "boxes" representing
each field of information. My field names correspond with my table names and
are:
BoxNumber
NameOfRecord
ScheduleType
ItemNumber
DateRanges
DestroyDate
Location

Currently I have tried the following code:
Private Sub Report_Page()
Dim intRows As Integer
Dim intLoop As Integer
Dim intTopMargin As Integer
Dim intDetailHeight As Integer
intRows = 18
intDetailHeight = Me.Section(0).Height
intTopMargin = 360
For intLoop = 10 To intRows
Me.Print intLoop + 1
Me.Line (0, intLoop * intDetailHeight +
intTopMargin)-Step(Me.Width, intDetailHeight), , B
Next
End Sub

but it does not draw the vertical lines that I need around each box, or
field, of information. other problems are that it goes beyond the width of
my page and includes the row numbers.

I need this grid to appear when previewed and printed. This database was
originally created in Access 2003, but I am now using Access 2007.

Thank you for any help.

~Tim
 
The code is designed to just put a box around detail section. If you want
multiple boxes you will need to tell us what determines how many and where.
If you don't want numbers, remove the line
Me.Print intLoop + 1
 
In my detail section I have 5 different fields that I need framed.
The fields (Text Boxes) are :

BoxNumber
NameOfRecord
ScheduleType
ItemNumber
BeginningDateRange

So I would like five frames / boxes going across the report starting in the
Detail section and extending down the rest of the page, whether the detail
section goes that far or not.
Hopefully it would look something like this:

_________________________________________________________________
|BoxNumber|NameOfRecord|ScheduleType|ItemNumber|BeginningDateRange
-------------------------------------------------------------------------------------------
|BoxNumber|NameOfRecord|ScheduleType|ItemNumber|BeginningDateRange
-------------------------------------------------------------------------------------------
|Blank |Blank |Blank |Blank |Blank

--------------------------------------------------------------------------------------------

With any blank sections extending the length of the report.

Thankyou,
~Tim
 
I would add to the code to loop through the controls in the detail section
and draw the boxes. Start by typing "Box" in the tag property of each of the
"5 different" text boxes (not fields). Then use code something like:

Private Sub Report_Page()
Dim intRows As Integer
Dim intLoop As Integer
Dim intTopMargin As Integer
Dim intDetailHeight As Integer
Dim ctl As Control
intRows = 18
intDetailHeight = Me.Section(0).Height
intTopMargin = 360
For intLoop = 10 To intRows
For Each ctl in Me.Section(0).Controls
If ctl.Tag = "Box" Then
Me.Line (ctl.Left, intLoop * intDetailHeight +
intTopMargin)-Step(Ctl.Width, intDetailHeight), , B
End If
Next
Next
End Sub
 
Duane
Sorry for revisiting this
The original poster was trying to get blank lines to fill the remainder of
the report as well as vertical lines between the fields.. I used the code
that was posted but i only have horizontal lines... am i going wrong
somewhere???


Any help is appreciated
Thanks

Barry
 
You should add some code or something to identify the value of
intDetailHeight. This should be the height of the detail section.

intDetailHeight = Me.Section(0).Height
 
Back
Top