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

Only 1 record showing in Detail section

Status
Not open for further replies.

mirirom

Programmer
Jul 21, 2001
110
US
howdy,

i'm trying to build a crosstab report, and for some reason only 1 record (the first record in the returned recordset) is showing up in the detail. here's the code i'm using...

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

' Place the income values and place them in the detail section under
' the appropriate months

Dim intX As Integer

' Verify that rstRecord is not at the end
If Not rstReport.EOF Then
' Make sure that the FormatCount argument is 1 before placing values

'If Me.FormatCount = 1 Then
For intX = 1 To intColumnCount
' Change null values to zero if necessary
Me("Col" + Format(intX)) = xtabCnulls(rstReport(intX - 1))
Next intX

' Move to the next record
rstReport.MoveNext
'End If
End If

End Sub

any thoughts on this? also, the recordset is being closed on the Close event.

mirirom
 
You need to loop through the records look at your code below now with this modification.

Dim intX As Integer

' Verify that rstRecord is not at the end
While Not rstReport.EOF
' Make sure that the FormatCount argument is 1 before placing values

'If Me.FormatCount = 1 Then
For intX = 1 To intColumnCount
' Change null values to zero if necessary
Me("Col" + Format(intX)) = xtabCnulls(rstReport(intX - 1))
Next intX

' Move to the next record
rstReport.MoveNext
'End If
Wend

End Sub

 
hi ToeShot,

thanks for the tip. i just made the change and this time it's now showing only the *last* record from the recordset. but after seeing this change, it seems as if the unbound textboxes i set up in the detail section are only showing up once (or creating only 1 instance). almost as if values from the first record are being put into the textboxes, the the next record called up is overwriting those values, so on & so forth, 'til the last record when the function ends.

am i crazy or is there some setting in the detail section properties that i'm missing? i was under the impression that by default, the detail section should format *all* the record data returned 'til the end of the record set.

mirirom
 
not too sure try adding this report.refresh
after rstreport.movenext

The report should have something to refresh or requery or update it with a new record after you are done formatting it. I am not sure what it is since I don't use reports like that( AS in I don't code in reports. just a personal preference.)

 
EUREKA!!!

figured it out. since this i was working with a toy model, i hadn't spent to much time on the input *interface* (where the parameters were coming from. i had created simple input boxes to set the qdf.parameter values; when the report would open, not only would i get my input boxes, but the query itself would ask for the data again.

to resolve this, i created a form for parameter entry and bound the query and the report to the form. works like a charm - all recordset data is showing and i'm only getting one prompt for parameters.

thanks again ToeShot, especially at this early hour =)

mirirom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top