Avatar of jkurzner

asked on 

Help with reading a recordset into variable object names for fdf and pdf output

I have created an ASP page to pull information from a recordset into the FDF toolkit to display a pre-filled pdf form to the end user.  I have created the pdf and have lots of form fields that need to be filled in.  I have successfully filled in the  objFdf.FDFSetValue information for information coming from a recordset.  My problem is that I have lots of FDF form fields that are named "P1Name", "P2Name", "P3Name", "P1Age", "P2Age", "P3Age", etc. etc.  I need to pull the information from the recordset and to fill in these values from each record.  Thus from record 1, I would pull the age and Name and place the age into P1Age and the Name into P1Name.  My problem is that I cannot use a variable for the 1st component of the objFdf.FDFSetValue fields. I have shown a small sample of the code that I hope explains my problem better.  I could really use some help.

'***   Create the FDF object.    
Set FdfAcX = Server.CreateObject("FdfApp.FdfApp")
Dim objFdf
Set objFdf = FdfAcX.FDFCreate
objFdf.FDFSetFile ""
objFdf.FDFSetValue "Date", Date(), Off
objFdf.FDFSetValue "TCode", TeamRS.Fields.Item("TCode"), Off
objFdf.FDFSetValue "Division", TeamRS.Fields.Item("Division"), Off
objFdf.FDFSetValue "BoysCheck", "Yes", Off
objFdf.FDFSetValue "Age", Left(Right(TeamRS.Fields.Item("Division"),3),2), Off
objFdf.FDFSetValue "CName", TeamRS.Fields.Item("CName"), Off
'This is the section I need help with               *
'loop through records
if (TeamRegRs.BOF = true AND TeamRegRS.EOF = true) then
  DIM n
    p.text = cStr("""P" & n & "Name""")
'  do while ((TeamRegRS.EOF <> true) AND (n < 23))
'    objFdf.FDFSetValue "P1Name", TeamRegRS.Fields.Item("LastName") & ", " & TeamRegRS.Fields.Item("FirstName"), Off
    objFdf.FDFSetValue p, TeamRegRS.Fields.Item("LastName") & ", " & TeamRegRS.Fields.Item("FirstName"), Off
'    n=n+1
'    TeamRegRS.MoveNext()
'  loop
end if

'***   Use the FDFSetStatus method to display an alert status box.
objFdf.FDFSetStatus "Your Team Registration Form has been created."

'***   Write the data back to the buffer stream.
Response.ContentType = "application/vnd.fdf"
Response.BinaryWrite objFdf.FDFSaveToBuf

'***   Close the object and clean-up.
Set objFdf = Nothing
Set FdfAcX = Nothing

ASPScripting LanguagesVB Script

Avatar of undefined
Last Comment

8/22/2022 - Mon