Results 1 to 4 of 4
  1. #1
    BmoBeastFoSho is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    2

    can't output or export my access report to sharepoint destination unc path using vba?


    My code is written in a button on a form. Trying to send the report up to sharepoint by using the following:
    docmd.openReport acOutputReport,
    "DailyReportPrint", acFormatPDF,
    "\\mysharepointsite.net\testingsite\SitePages\ & ".pdf"
    End sub

    Any help would be greatly appreciated. I've been stuck on this for a few weeks. Sometimes i get the 2501 OutputTo cancelled error. No luck getting files up to my sharepoint destination path.

  2. #2
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    Not sure if "OpenReport" is the right command.

  3. #3
    BmoBeastFoSho is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    2

    I revised the code but still now working...

    Quote Originally Posted by lfpm062010 View Post
    Not sure if "OpenReport" is the right command.


    Private Sub Command89_Click()


    Dim MyPath As String
    Dim MyFiLeName As String
    MyFilter = ""
    MyPath = "\\mysharepointsite.net\testingsite\sitepages\"
    MyFiLeName = "ReportNewer.pdf"

    DoCmd.OpenReport "DailyReportPrint", acViewPreview
    DoCmd.OutputTo acOutputReport, "DailyReportData", acFormatPDF, MyPath & MyFiLeName, False

    DoCmd.Close acReport, "DailyReportPrint"
    End Sub

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I thought VBA code couldn't be used in sharepoint, just embedded macros and the like.

    But why are you trying to preview and export the file then close the file



    Code:
    DoCmd.OpenReport "DailyReportPrint", acViewPreview
    DoCmd.OutputTo acOutputReport, "DailyReportData", acFormatPDF, MyPath & MyFiLeName, False
    DoCmd.Close acReport, "DailyReportPrint"
    This looks like you're opening it in print preview, then exporting it, then closing the file, which, theoretically would give you just the run time of the query on the export to view the report.

    Code:
    DoCmd.OutputTo acOutputReport, "DailyReportData", acFormatPDF, MyPath & MyFiLeName, False
    This should be the only line you need

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

Similar Threads

  1. Replies: 13
    Last Post: 12-12-2013, 07:22 PM
  2. Replies: 5
    Last Post: 10-23-2013, 10:17 AM
  3. Replies: 1
    Last Post: 06-29-2013, 01:49 AM
  4. Access Export vs Output
    By buckwheat in forum Access
    Replies: 15
    Last Post: 02-01-2013, 03:58 PM
  5. Macro Export Deletes it's Destination File
    By maxCohen in forum Access
    Replies: 2
    Last Post: 05-06-2011, 09:07 PM

Tags for this Thread

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