John said:
Yes, the the report is unbound. I ReDim the array to the
size I need, but in the example I sent the size is 6 x 10.
The 6 would be the number of records and the 10 is the
number of fields. The 10 remands constant. I left out the
other fields so things would not get too complex. Here's
how the values are entered into the array,
Calling Number:
Drawing Number
Others.....
DrawingsList(0, 0) = "77429003-009"
DrawingsList(0, 1) = "77429003-009"
.
DrawingsList(1, 0) = "77429003-009"
DrawingsList(1, 1) = "717700817-001"
.
DrawingsList(2, 0) = "77429003-009"
DrawingsList(2, 1) = "77429004-001"
.
DrawingsList(3, 0) = "77429004-001"
DrawingsList(3, 1) = "77400800"
.
DrawingsList(4, 0) = "77429004-001"
DrawingsList(4, 1) = "77420001"
.
DrawingsList(5, 0) = "77429004-001"
DrawingsList(5, 1) = "79P070000"
Well, I don't know why you don't have this data in a table??
After all, we are using a database system here!
You've left out the reason why there are only two drawings
for the first Calling number and three for the second one.
So I'll ignore that issue.
But, if you insist on using an array, I think the easiest
way you can do this is by using the report's Page event to
do all the work. The code uses the Print method to display
the array data.
Private Sub Report_Page()
Dim J As Integer, K As Integer
Dim lngLeftEdge As Long
Me.FontName = "Arial"
Me.FontSize = 12
lngLeftEdge = 800 'twips, 1440 twips = 1 inch
Me.CurrentY = 1400
For K = 0 To UBound(DrawingsList)
Me.CurrentX = lngLeftEdge
Me.Print "Calling Number:"
Me.CurrentX = lngLeftEdge + 1000
Me.Print DrawingsList(K, 0)
Me.CurrentX = lngLeftEdge + 500
Me.Print "Drawing Number:"
For J = K To UBound(DrawingsList)
If DrawingsList(J, 0) <> DrawingsList(K, 0) _
Then Exit For
Me.CurrentX = lngLeftEdge + 1500
Me.Print DrawingsList(J, 1)
Next J
K = J - 1
Next K
End Sub
Add your own error handling.
If the data can spill over onto a second page, you've got a
real mess on you hands. To return to my opening remark,
please reconsider and use a table for this kind of thing.