Results 1 to 4 of 4
  1. #1
    95DSM is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jul 2010
    Posts
    37

    Rookie Question

    Ok... listed below are my fields, table, query, and report, and form. I'm trying to create a form that is based off of a query. This form has the ability to open a report for an overal view of the fields associated with the ID. Within the Report there is a button that when clicked will Output the report into a PDF and save it to a specific folder on my computer desktop. Currently the report, query, and form work correctly. The only thing I cannot get to work is the saving of a unique save name So when I click the "btnPrintReports" button on the report there should be a new PDF file in my folder with the unique name addressed in the report.

    Table Name: Users
    Fields in Tbl: ID, UserID, FullName, Email, Org, SupName, SupEmail ** Which should be the specific save name**
    Form Name: Users
    Report Name: Users
    Query Name: Users ** Criteria in ID Field: [Forms]![Users]![ID] ***

    Code behind button on RptUsers is as follows....
    ---------------------------------------------------------------------------------
    Option Compare Database

    Private Sub btnPrintReports_Click()

    Dim myPath As String
    Dim strReportName As String
    DoCmd.OpenReport "Users", acViewPreview, acWindowNormal
    myPath = "C:\Users\TestFolder"
    strReportName = Me.tb_SupEmail & ".pdf"
    DoCmd.OutputTo acOutputReport, "", acFormatPDF, myPath + strReportName, True
    DoCmd.Close acReport, "RptUsers"

    End Sub
    ---------------------------------------------------------------------------------


    Any suggestions would be greatly appreciated!


    Regards,

    95DSM

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    What is the issue you encounter - error message, wrong results, nothing happens? Might have something to do with missing a \ in the OutputFile name

    myPath = "C:\Users\TestFolder\"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    95DSM is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jul 2010
    Posts
    37
    Quote Originally Posted by June7 View Post
    What is the issue you encounter - error message, wrong results, nothing happens? Might have something to do with missing a \ in the OutputFile name

    myPath = "C:\Users\TestFolder\"
    I get the following error..

    "Compile error: Method or data member not found"

    But the thing I'm confused about is that the following line of code is being highlighted

    strReportName = Me.tb_SupEmail & ".pdf"


    Any ideas?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    VBA is not finding anything named tb_SupEmail. Is this correctly spelled? Where is the control located in relation to where the code is?

    The missing \ is still a concern.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. ROOKIE NEEDS HELP using forms
    By Eugene in forum Forms
    Replies: 1
    Last Post: 12-16-2011, 09:52 AM
  2. Please Help! Access Rookie
    By kewlgolf in forum Access
    Replies: 4
    Last Post: 12-01-2011, 10:29 AM
  3. VBA rookie needs help
    By everette in forum Programming
    Replies: 5
    Last Post: 10-16-2010, 03:59 PM
  4. Rookie Messed Up Main Input Form
    By genest11 in forum Forms
    Replies: 2
    Last Post: 01-14-2010, 02:17 PM
  5. Rookie needs help with basic reporting
    By James Rousselle in forum Reports
    Replies: 0
    Last Post: 03-01-2007, 02:36 PM

Posting Permissions

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