Handle5892
Programmer
I created several reports dynamically (based on results from several queries). However, I cant get this reports to populate with the data that I want when I preview them.
I set the RecordSource of each report a a particular query stored in the database. In order to get the report to populate I have to add the code below to the Detail_Format Sub. However, I cannot hardcode this becuase the report is generated dynamically. How can I do the below code without using the Detail_Format sub (instead I want to use a fuction defined in one of my modules)?
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' Put values in text boxes (report controls)
Dim intX As Integer
' Verify that you are not at end of recordset.
'rstCurrViewData is the record set that contains the data
If Not rstCurrViewData.EOF Then
If Me.FormatCount = 1 Then
For intX = 1 To rstCurrViewData.Fields.Count
Me(intX - 1) = rstCurrViewData(intX - 1)
Next intX
' Move to next record in recordset.
rstCurrViewData.MoveNext
End If
End If
End Sub
I set the RecordSource of each report a a particular query stored in the database. In order to get the report to populate I have to add the code below to the Detail_Format Sub. However, I cannot hardcode this becuase the report is generated dynamically. How can I do the below code without using the Detail_Format sub (instead I want to use a fuction defined in one of my modules)?
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' Put values in text boxes (report controls)
Dim intX As Integer
' Verify that you are not at end of recordset.
'rstCurrViewData is the record set that contains the data
If Not rstCurrViewData.EOF Then
If Me.FormatCount = 1 Then
For intX = 1 To rstCurrViewData.Fields.Count
Me(intX - 1) = rstCurrViewData(intX - 1)
Next intX
' Move to next record in recordset.
rstCurrViewData.MoveNext
End If
End If
End Sub