Get code to loop

I have this section of code looking at a form with the name = “pdf”. Sometimes there may be 2 forms that need loaded - how can I get this code to load both forms with their own doclink on 2 lines? Right now, because of the line reading "pdfLnk = pdfLnk + ", “” I am getting one doclink plus the report name then a comma then the next budget number, but no doclink.

What I’m getting:

[doclink] 2007 Student Report for 0901020 UP, 0901020 UP

What I need:

[doclink] 2007 Student Report for 0901020 UP

[doclink] 2007 Student Report for 0901020 UP

Elseif rpt.form(0) = “pdf” And rpt.RptType(0) = “Student Report” Then

								If pdfCt = 0 Then

									Set pdfRpt = rpt

									pdfLnk = Trim(Str(rpt.fy(0))) + " Student Report for "

								End If

								pdfCt = pdfCt + 1

								If pdfCt > 1 Then

									pdfLnk = pdfLnk + ", "

								End If

								pdfLnk = pdfLnk + rpt.dspbudget(0)

Subject: Get code to loop

This posting is clearer that the other one!

Try this code.

Set pdfRpt = rpt

pdfLnk = Trim(Str(rpt.fy(0))) + " Student Report for "

pdfLnk = pdfLnk + rpt.dspbudget(0)

pdfCt = pdfCt + 1

I have removed all IF and ELSE lines from your code. Since don’t want special handling for first record, there is no need for IF-ELSE.

Regards

Litty Joseph

Subject: RE: Get code to loop

Thank you, Litty, but I need the ifs and elseifs because I’m working with 3 forms, this was just the code from the one form = pdf. I updated that portion like this:

Elseif rpt.form(0) = “pdf” And rpt.RptType(0) = “Student Report” Then

Set pdfRpt = rpt

								pdfLnk = Trim(Str(rpt.fy(0))) + " Student Report for "

								pdfLnk = pdfLnk + rpt.dspbudget(0)

								pdfCt = pdfCt + 1

and am now just only getting the one document, not both for the budget. Any ideas?