none
help with output of access 2007 report to a folder in windows 10 RRS feed

  • Question

  •  I need help with output of access 2007, as I am trying to send a report in pdf format to a folder in windows 10 but getting no output.  This works in windows 7 though.  What has changed?

    Monday, June 5, 2017 9:50 PM

All replies

  • Hi,

    What does your code look like? Do you have write permission to the Win10 folder?

    Monday, June 5, 2017 9:54 PM
  • Private Sub openmonthlycdachoursreport_Click()
    On Error GoTo Err_openmonthlycdachoursreport_Click
        Dim stDocName As String
        stDocName = "Monthly CDAC Hours Report"
        DoCmd.OpenReport stDocName, acPreview
        'Added by BG 07/03/2009
        Dim sReportStartDate As String
        sReportStartDate = Reports![Monthly CDAC Hours Report]![txtHiddenBeginningDate]
        Dim sReportEndDate As String
        sReportEndDate = Reports![Monthly CDAC Hours Report]![txtHiddenEndingDate]
     
        Dim sStartDate As String
        sStartDate = Format(CDate(sReportStartDate), "mmddyy")
        Dim sEndDate As String
        sEndDate = Format(CDate(sReportEndDate), "mmddyy")
     
        Dim sReportFolder As String
        sReportFolder = "C:\Users\bernard\Bernard's Documents\Personal\Pearl\AmeriHealth Caritas Iowa\Invoices\"
        Dim iGetAttrResult As Integer
        On Error Resume Next
        iGetAttrResult = GetAttr(sReportFolder)
        Select Case Err.Number
            Case 0
                'Exists
            Case Else
                'Does not exist
                MsgBox "*** ERROR: Folder " & sReportFolder & " not found."
                GoTo Exit_openmonthlycdachoursreport_Click
        End Select
        On Error GoTo Exit_openmonthlycdachoursreport_Click
       
        Dim sPDFFileName As String
        sPDFFileName = stDocName & " " & sStartDate & "-" & sEndDate & ".pdf"
       
        DoCmd.OutputTo acOutputReport, stDocName, acFormatPDF, sReportFolder & sPDFFileName
        'End Of Addition

    Exit_openmonthlycdachoursreport_Click:
        Exit Sub
    Err_openmonthlycdachoursreport_Click:
        MsgBox Err.Description
        Resume Exit_openmonthlycdachoursreport_Click
       
    End Sub
    Monday, June 5, 2017 10:12 PM
  • Do you get any error message? Do you have "write" or "modify" permission to the Win10 folder?
    Monday, June 5, 2017 10:14 PM
  • I already have read/write permissions.

    Tuesday, June 6, 2017 12:24 AM
  • Were you getting any error messages?
    Tuesday, June 6, 2017 1:26 AM
  • Hi Bernard Gill,

    I try to test the code on my side, I did not get any error if I change all the control references as per my report and there is report available on that machine.

    if report is not available or report does not contain the controls that you are referencing in the code then you can get error below.

    the main line of code to export report as pdf is below.

    DoCmd.OutputTo acOutputReport, stDocName, acFormatPDF, sReportFolder & sPDFFileName

    I can see that you are trying to concate variables.

    please try to check that you are passing the correct path and file name. I know that you are checking for the valid folder but I suggest you to check the whole path in line mentioned above to confirm that it is correct and valid.

    note that in the name of the file you try to use '-' as separator instead of '/' in date. other wise it will give you error.

    if possible for you then try to execute above line of code separately and pass the parameters manually to confirm whether it is working or not.

    for further reference you can visit link below.

    DoCmd.OutputTo Method (Access)

    let us know about your testing results , so that we can try to provide further suggestions to solve the issue.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, June 6, 2017 2:02 AM
    Moderator
  • I checked that the file path and folder name were correct. When I run the report the code is inserted as an event procedure in the on click feature of the button that runs the report. The report runs accurately, but does not indicate that it is being generated and saved as a pdf.
    Tuesday, June 6, 2017 1:39 PM
  • Have you tried stepping through the code? Just curious...
    Tuesday, June 6, 2017 3:50 PM
  • Hi Bernard Gill,

    you had mentioned that ,you are using this code on click event of button.

    so what happened, when you click on button?

    make sure that your button referring to correct click event.

    try to set a break point on click event and check whether it got hit when you click on that button.

    then try to check that 'DoCmd.OutputTo ' statement get executed.

    if that get execute successfully then it is possible that it is exporting the PDF file but you are not checking at correct location in file explorer.

    if possible for you then try to post that path here, generated by your code and actual path.

    so that we can try to compare it.

    without that , we are just guessing for the possibilities.

    Regards

    Deepak  


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, June 7, 2017 7:12 AM
    Moderator
  • It's still the same result.  This runs fine on all of my other windows systems, no matter which folder I choose to output to.  I also get visual feedback when Access executes the code and creates the pdf.  i'm just not getting the same results in Windows 10.  Access will run the report, but will not create a pdf file in the requested folder. Again here is the code, and I can also send a copy of the dbase if you request I do so.
    Thursday, June 8, 2017 1:45 AM
  • Hi Bernard Gill,

    you had mentioned that you got the same result on Windows 10.

    I am also testing with Windows10 and on my side I am able to create PDF file without any issue.

    you also mentioned in previous reply that you have the read/ write permission.

    so it's a strange issue.

    it is better , if you post your sample database, we will try to make a test with it on our side.

    you can try to share the database on any free resource sharing website and post the link here.

    we will try to visit the link and check your database.

    Regards

    Deepak 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, June 9, 2017 1:18 AM
    Moderator
  • Hi Bernard Gill,

    is your issue solved?

    if yes then try to share the solution on this thread and try to mark it as an answer.

    so that we can close this thread.

    if your issue is still exist then try to let us know about that.

    post your latest code or database.

    we will try to test that again and try to provide you further suggestions to solve the issue.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, June 28, 2017 7:45 AM
    Moderator