Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2015

    Unanswered: FileOpenSave error message

    I have this function to export data as an excel file (Access 2003)
    It sort of works after the second try (see attached photos)

    ' Purpose: creates an excel worksheet that contains an inventory of parts

    Private Sub btnExportInventory_Click()
        Dim strFilter As String
        Dim strSaveFileName As String
        'Ask for SaveFileName
        strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.xls)", "*.xls")
        strSaveFileName = ahtCommonFileOpenSave( _
                                            OpenFile:=False, _
                                            Filter:=strFilter, _
                            Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)
        DoCmd.OutputTo acOutputQuery, "qryPartInventory", acFormatXLS, strSaveFileName, True
    The code works, I get a save as window, but I get this error message too

    Click image for larger version. 

Name:	open.PNG 
Views:	4 
Size:	14.3 KB 
ID:	16477

    if I press cancel on the save as window I get this

    Click image for larger version. 

Name:	canc.PNG 
Views:	3 
Size:	46.1 KB 
ID:	16478

    I have gone over it again and again but I must be missing something.
    Also I'm on Windows 7 with an admin account.
    Last edited by Missinglinq; 07-30-15 at 11:40. Reason: Added Code Tags

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    and the file location you are trying to write to is
    you've checked its valid
    youve checked you have permissions to write there
    you've checked your application has permissions to write there
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts