Save current record on form as PDF and loop to next

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • John smith 38
    New Member
    • May 2012
    • 1

    Save current record on form as PDF and loop to next

    Hi, hopefully someone can help me with this.

    I have a table and linked a form to it. My form looks nice (like a report) and has 1000's of records.

    Currently i can save each record as a PDF but i have to type the file name (i use the print current record option on cute PDF) and doing this for 1000's of records is horrible.

    Can someone help me to create a basic VBA code that i can click one command button and it then saves each record as a PDF using the main field and then move to the next using a loop. At the end i would like a folder with 1000's of PDF's of each of my records named after the main field.


    If we can call my form "abc" and the main field / primary key for each record as "xyz" that would be great.

    So with the primary key "xyz" this would have each record called "1", "2", "3" etc


    I know it would have to open form abc, find xyz key and save record 1 as "1"
    repeat for next record and save as "2" etc

    Sorry if im not clear but i think i have explained it as basic as i can and hopefully the file / form names are easy for reference purposes.

    I use access 2010.

    Thank you for any help anyone gives, i appreciate it.
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #2
    Basically a form isn't mutch different as a report, thus you might check this code for printing a report to a PDF file:

    By creating a recordset processing loop and passing the unique key as filter (and filename) this could be a way to do it yourself.

    Nic;o)

    Comment

    Working...