Results 1 to 2 of 2

Form Me. Values aren't getting captured in Loop

  1. #1
    Enrightt is offline Novice
    Windows 8 Access 2007
    Join Date
    Oct 2015

    Form Me. Values aren't getting captured in Loop

    Hello All,

    I'm trying to mass output PDFs from an Access form. The form ties to a report which is driven of the current Form values. The following code is intended to cycle through all available form records and generate a corresponding report to pdf.

    Without the loop it works, but when it cycles through the records, it seems that it's going to fast for Access. Even though the Access starts going to subsequent form records, the 'Me. Values' never update to the current record and the script just rewrites over the same file over and over again.

    Any idea on how to slow this down to have the Me. Values update for each record appropriately?

    FileName = Me.Supplier_Name & " - " & Me.Invoice_Num
    Filepath = Environ("UserProfile") & "\Desktop\" & FileName & ".pdf"
    While Me.CurrentRecord < Me.Recordset.RecordCount
        'CurrentDb.Execute "Invoice Header - Report"
        DoCmd.OutputTo acOutputReport, "Invoice PDF - Report", acFormatPDF, Filepath
        DoCmd.GoToRecord , , acNext
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Nevada, USA
    The Me values are retrieved prior to the loop. Try within the loop.
    Paul (wino moderator)
    MS Access MVP

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Macro Loop values in Form ang get values to query
    By mauryc1990 in forum Programming
    Replies: 13
    Last Post: 12-22-2017, 07:30 AM
  2. Replies: 5
    Last Post: 12-01-2017, 12:40 PM
  3. Replies: 15
    Last Post: 01-17-2014, 11:08 AM
  4. Replies: 8
    Last Post: 12-18-2013, 02:00 PM
  5. Replies: 3
    Last Post: 03-10-2013, 06:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Tech Forums: Microsoft Office Forums