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

Only getting 1st or last record in details section of report

Status
Not open for further replies.

elvenmaiden

Programmer
Apr 25, 2002
31
US
Trying to hard code a report based on a recordset. Problem with obtaining more than one record in the details section of the report.

I tried without a loop and with a loop. Without a loop I get the first record of the recordset - with a loop I get the last record of the recordset.

Is there some kind of carriage return or reassignment of information needed? Please help. Thanks!!!

Below is the code for the detail section with the loop structure commented out.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Dim intX As Integer

'verify that not at end of recordset
If Not rsSalesHours.EOF Then

'ensures FormatCount is not showing hold for next page
If Me.FormatCount = 1 Then

'Do Until rsSalesHours.EOF

'fill detail text boxes
For intX = 1 To mintColumnCount
Me("Detail" + Format$(intX)) = rsSalesHours (intX - 1)

Next intX

'hide unused text boxes in detail section
For intX = (mintColumnCount + 2) To 16
Me("Detail" + Format$(intX)).Visible = False
Next intX


'move to next record
rsSalesHours.MoveNext

'Loop

End If

End If

End Sub
 
to assign a recordset as the recordsource it needs to be done in the report_open event...

some thing like this is all that's needed...


me.recordsource = "sql statment"
or
me.recordsource = recordsetvariable

hope this helps...

--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top