Results 1 to 2 of 2
  1. #1
    TG_W is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2010
    Location
    Manvel, TX
    Posts
    299

    File Dialog box pops up after saving the first time

    Here's one that I think is something minor I am overlooking. I am trying to give the users an option to export a report in either Excel or PDF. The Excel DoCmd.TransferSpreadsheet works fine, but the PDF DoCmd.OutputTo brings up a second save window after accepting the first. I MUST have the file dialog option as this will be issued for use in both my local office and internationally, so I cannot force an output location.



    cboReports is where the user selects the report. Column(0) is the report name and appears in the combo box. Column(1) is the report object name. Column(2) is the query onject name that populates the report.

    cboFormat is where the user selects the format they want to export to. Column(0) is the format name (Excel or PDF). Column(1) is the file extension.

    Code:
    Private Sub cmdExport_Click()
        
        Dim fd As FileDialog
        Dim FN As String
        Dim vrtSelectedItem As Variant
        Set fd = Application.FileDialog(msoFileDialogSaveAs)
        FN = [Forms]![frmReportMenu]![sfrSystems].[Form]![Proj] & " " & Me.cboReports.Column(0) & Me.cboFormat.Column(1)
        
        With fd
            .AllowMultiSelect = False
            .Title = "Save Report"
            .InitialFileName = FN
            If .Show = True And Me.cboFormat.Column(0) = "Excel" Then
                DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, Me.ExportExcel, [Forms]![frmReportMenu]![sfrSystems].[Form]![Proj] & " " & Me.cboReports.Column(0), Yes
            ElseIf .Show = True And Me.cboFormat.Column(0) = "PDF" Then
                DoCmd.OutputTo acOutputReport, Me.ExportPDF, acFormatPDF, .SelectedItems(1)
            End If
        End With
        
    End Sub

  2. #2
    TG_W is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2010
    Location
    Manvel, TX
    Posts
    299
    Had to remove ".Show = True And " from the ElseIf.

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

Similar Threads

  1. Save As dialog box exporting Excel file
    By accessnewbie in forum Access
    Replies: 1
    Last Post: 03-09-2013, 03:15 PM
  2. Replies: 21
    Last Post: 08-20-2012, 11:59 PM
  3. Search for associated folders in file dialog box
    By john_billau in forum Programming
    Replies: 1
    Last Post: 01-27-2012, 03:48 PM
  4. Replies: 21
    Last Post: 01-24-2012, 06:21 PM
  5. How to get a load file dialog?
    By degras in forum Programming
    Replies: 4
    Last Post: 04-21-2011, 07:45 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
  •  
Other Forums: Microsoft Office Forums