<!-- Copyright (c) 2021 ActivePDF, Inc. --> <!-- ActivePDF Toolkit 2018 --> <!-- Example generated 04/17/21 --> <% Dim strPath, intOpenOutputFile, strSQL, strConn, _ intLoadDBMapFile, intDBToForm strPath = Server.MapPath(".") & "\" ' Instantiate Object Set oTK = Server.CreateObject("APToolkit.Object") ' Create the new PDF file intOpenOutputFile = oTK.OpenOutputFile(strPath & "new.pdf") If intOpenOutputFile <> 0 Then ErrorHandler "OpenOutputFile", intOpenOutputFile End If ' Specify the template form to populate oTK.SetDBInputTemplate strPath & "dbtemplate.pdf" ' Set query command to a variable strSQL = "Select * From Supplier" ' Set connection String to a variable strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath & "xtreme.mdb" & ";Persist Security Info=False" ' Set master query oTK.SetMasterQuery strConn, "Admin", "", -1, strSQL ' Set the row Separator oTK.SetDBMultiRowSeparator "" ' Related query separator is only needed if different from default of '|' oTK.RelatedQuerySeparator = "|" ' Add related query oTK.AddRelatedQuery strConn, "Admin", "", -1, strSQL, true ' If db column names are different then field names a map file is needed ' In this example only the zip/postal code is different intLoadDBMapFile = oTK.LoadDBMapFile(strPath & "dbformmap.txt") If intLoadDBMapFile <> 0 Then ErrorHandler "LoadDBMapFile", intLoadDBMapFile End If ' Flatten fields that are populated with data oTK.SetDefaultDBMergeFlag -997 ' Flatten all other fields on the form oTK.FlattenRemainingFormFields = 1 ' Fill the template form intDBToForm = oTK.DBToForm(false) If intDBToForm <> 0 Then ErrorHandler "DBToForm", intDBToForm End If ' Clear and close used queries oTK.ClearQueries ' Close the output file oTK.CloseOutputFile ' Release Object Set oTK = Nothing ' Process Complete Response.Write "Done!" ' Error Handling Sub ErrorHandler(method, outputCode) Response.Write("Error in " & method & ": " & outputCode) End Sub %>