Loop through records on a continuous subreport

I have a report with a continuous report as the subreport in the detail section of the parent report. I am trying to use the following to code to load data into a text control on my subreport but it's loading the values for the first record on every record if there are multiple records on the continuous report. How can I get this code to work where it loops through each record on the continuous subreport to show the correct data for that specific record instead of only using the data from the first record? The following code fires on the "On Format" event of the detail section on my parent report.

Dim Length As String
Dim LengthOpt As String
Dim LengthTol As String
Dim MemoDesc As String

If IsNull(Reports![rptQuotePDF]![srptQuoteDetail].Report![MaterialLengthTolerance]) Then
    LengthOpt = ""
    LengthTol = "RL"
Else
    LengthOpt = Reports![rptQuotePDF]![srptQuoteDetail].Report![MaterialLengthToleranceOpt]
    LengthTol = Reports![rptQuotePDF]![srptQuoteDetail].Report![MaterialLengthTolerance]
End If

MemoDesc = vbNullString

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![MaterialTemper] <> vbNullString) Then
    MemoDesc = MemoDesc & "Material-Temper: " & Reports![rptQuotePDF]![srptQuoteDetail].Report![MaterialTemper] & vbNewLine
End If

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![OuterDiameter] <> vbNullString Or Reports![rptQuotePDF]![srptQuoteDetail].Report![OuterDiameterTolerance] <> vbNullString) Then
    MemoDesc = MemoDesc & "Outer Diameter: " & LTrim(RTrim(Reports![rptQuotePDF]![srptQuoteDetail].Report![OuterDiameter])) & "-" & LTrim(RTrim(Reports![rptQuotePDF]![srptQuoteDetail].Report![OuterDiameterTolerance])) & vbNewLine
End If

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![MaterialLength] <> vbNullString) Then
    MemoDesc = MemoDesc & "Length: " & LTrim(RTrim(Reports![rptQuotePDF]![srptQuoteDetail].Report![MaterialLength])) & " IN" & LengthOpt & " " & LengthTol & vbNewLine
End If

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![MaterialRoundness] <> vbNullString) Then
    MemoDesc = MemoDesc & "Roundness: " & Reports![rptQuotePDF]![srptQuoteDetail].Report![MaterialRoundness] & vbNewLine
End If

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![MaterialStraightness] <> vbNullString) Then
    MemoDesc = MemoDesc & "Straightness: " & LTrim(RTrim(Reports![rptQuotePDF]![srptQuoteDetail].Report![MaterialStraightness])) & "/" & Reports![rptQuotePDF]![srptQuoteDetail].Report![MaterialStraightnessUoM] & vbNewLine
End If

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![MaterialHardness] <> vbNullString) Then
    MemoDesc = MemoDesc & "Hardness: " & Reports![rptQuotePDF]![srptQuoteDetail].Report![MaterialHardness] & vbNewLine
End If

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![MaterialSurfaceFinish] <> vbNullString) Then
    MemoDesc = MemoDesc & "Surface Finish: " & Reports![rptQuotePDF]![srptQuoteDetail].Report![MaterialSurfaceFinish] & vbNewLine
End If

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![BarEndTOBarEnd] <> vbNullString) Then
    MemoDesc = MemoDesc & "Bar End to Bar End: " & Reports![rptQuotePDF]![srptQuoteDetail].Report![BarEndTOBarEnd] & vbNewLine
End If

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![BarEndChamfer] <> vbNullString) Then
    MemoDesc = MemoDesc & "Bar End Chamfer: " & Reports![rptQuotePDF]![srptQuoteDetail].Report![BarEndChamfer] & vbNewLine
End If

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![SpecASTM] <> vbNullString) Then
    MemoDesc = MemoDesc & "ASTM: " & Reports![rptQuotePDF]![srptQuoteDetail].Report![SpecASTM] & vbNewLine
End If

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![SpecAMS] <> vbNullString) Then
    MemoDesc = MemoDesc & "AMS: " & Reports![rptQuotePDF]![srptQuoteDetail].Report![SpecAMS] & vbNewLine
End If

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![SpecQQ] <> vbNullString) Then
    MemoDesc = MemoDesc & "QQ: " & Reports![rptQuotePDF]![srptQuoteDetail].Report![SpecQQ] & vbNewLine
End If

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![SpecCDA] <> vbNullString) Then
    MemoDesc = MemoDesc & "CDA: " & Reports![rptQuotePDF]![srptQuoteDetail].Report![SpecCDA] & vbNewLine
End If

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![SpecMIL] <> vbNullString) Then
    MemoDesc = MemoDesc & "MIL: " & Reports![rptQuotePDF]![srptQuoteDetail].Report![SpecMIL] & vbNewLine
End If

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![SpecOther] <> vbNullString) Then
    MemoDesc = MemoDesc & "Other Spec: " & Reports![rptQuotePDF]![srptQuoteDetail].Report![SpecOther] & vbNewLine
End If

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![CustomRequirements] <> vbNullString) Then
    MemoDesc = MemoDesc & "Custom Requirements: " & Reports![rptQuotePDF]![srptQuoteDetail].Report![CustomRequirements] & vbNewLine
End If

If (Reports![rptQuotePDF]![srptQuoteDetail].Report![LeadTime] <> vbNullString) Then
    MemoDesc = MemoDesc & "Delivery: " & Reports![rptQuotePDF]![srptQuoteDetail].Report![LeadTime]
End If

Reports![rptQuotePDF]![srptQuoteDetail].Report![txtDescMemo] = MemoDesc

Open in new window

LVL 1
Lawrence SalvucciInformation Technology ManagerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
You need to move the code to the sub-report, detail section, on format event.   That will fire once for each subreport record that exists.

Jim.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Lawrence SalvucciInformation Technology ManagerAuthor Commented:
Thank you! I thought I had it in the wrong place.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.