Create a table Dummy with column Counter of number data type, and
enter values from1 to 100 say. Then base the report (or a subreport
if you want the grid within another bound report) on a query such as:
SELECT NULL AS a, NULL AS b, NULL AS c
FROM Dummy
WHERE counter<=5;
This will give you a grid 3x5. Add side-by side text boxes bound to
the columns (a,b and c in this example) to the detail section and in
the detail section's Format event procedure put:
Dim lngHeight As Long
Dim X1 As Single
Dim Y1 As Single
Dim Y2 As Single
Dim X2 As Single
Me.DrawStyle = 0
' Find the height of the tallest control in the row
Dim ctrl As Control
For Each ctrl In Me.Section(acDetail).Controls
If ctrl.Height > lngHeight Then
lngHeight = ctrl.Height
End If
Next ctrl
If PrintCount = 1 Then
' Draw the box around the record
For Each ctrl In Me.Section(acDetail).Controls
X1 = ctrl.Left
X2 = ctrl.Left + ctrl.Width
Y1 = ctrl.Top
' add twenty twips at bottom to
' avoid tight cropping to text
Y2 = lngHeight + 20
Me.Line (X1, Y1)-(X2, Y2), vbBlack, B
Next ctrl
End If
As you are drawing an empty grid you don't really need to bother
avoiding tight cropping to the text, but using this code to draw a
grid around bound controls you'll find it looks better if you do.
Ken Sheridan
Stafford, England