Access - Save As in VBA RRS feed

  • Question

  • I am attempting to create a SAVE AS dialox where users can save the active database to My Documents or to a location they choose. Getting a "run-time error 438 - object doesn't support this property or method." 

    Any direction would be appreciated. Thanks

    Private Sub btnSaveAs_Click()
       Dim dialog As FileDialog
        Set dialog = Application.FileDialog(msoFileDialogSaveAs)
        Call dialog.Filters.Add("MPA03 Files", "*.mdb")
        dialog.Title = "Save As File Name"
        ' See if the user canceled.
        If file_name = False Then Exit Sub
        ' Save the file with the new name.
        If LCase$(right$(file_name, 4)) <> ".mdb" Then
            file_name = file_name & ".mdb"
        End If
        FileCopy CurrentDb.Name, file_name
    End Sub

    jim neal

    Thursday, August 30, 2012 2:06 AM


All replies

  • In Access 2007 and before, FileDialog(msoFileDialogSaveAs) is not supported - see for example

    In Access 2010, you can use FileDialog(msoFileDialogSaveAs), but you can't modify the Filters.

    Regards, Hans Vogelaar

    • Marked as answer by JamesLNeal Sunday, September 16, 2012 12:37 AM
    Thursday, August 30, 2012 5:39 AM
  • a small addition:

    If you need anyway you can create a excel object (set xlApp=CraeteObject("Excel.Application") and get the dialog box (xlApp.FileDialog). Excel supports it.

    And you can modify filter.

    Best Regards,
    Asadulla Javed, Kolkata
    Please do not forget to click “Vote as Helpful” if any post helps you and "Mark as Answer”if it solves the issue.

    Thursday, August 30, 2012 6:51 AM