Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228

    Failure to create file : 3436

    This code has worked for over a year. But today it's changed its mind:



    Code:
    Private Sub Command18_Click()
        Dim dbs As DAO.Database
        Dim rstSAGE As DAO.Recordset
        Dim myQueryName As String         '<<--missing declaration
        Dim myExportFileName As String    '<<--missing declaration
    
            DoCmd.SetWarnings False  '<<--Not needed
    
        Set dbs = CurrentDb
        Set rstSAGE = dbs.OpenRecordset("sageimport4")
    
        myQueryName = "sageimport4"
        
        ' Either of these lines create the Excel file in my Documents directory
        '
        '    myExportFileName = "SERVER LOCATION " & "PO.xlsx"
        myExportFileName = "\\-len-3\accounts\2010\Company.000\Import Maps\Audit Trail transactions\ " & Trim(Format(Date, "yyyy_mm_dd")) & "_PO.xlsx"  '<<-- I added a "_" before the PO for readability
    
    
        If Not rstSAGE.EOF Then
            '  DoCmd.TransferSpreadsheet acExport, 10, myQueryName, myExportFileName, True    '<-- don't like using 10.
            DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, myQueryName, myExportFileName, True  '<< I prefer acSpreadsheetTypeExcel12Xml.
            MsgBox "Your Sage report has been created."
        Else
            MsgBox "There are no records to import to sage."
        End If
    DoCmd.OpenQuery "sage import update"
    
    
            DoCmd.SetWarnings True   '<<--Not needed
    
       'Clean up
        rstSAGE.Close
        Set rstSAGE = Nothing
        Set dbs = Nothing
    
    
    End Sub
    This is the highlighted line in debug:

    Code:
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, myQueryName, myExportFileName, True
    Ill do some reading and see what I can do.. (maybe recover an older version),

    Does anyone have any ideas why this would happen or how I can fix this?

    Thanks, Andy.

  2. #2
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    I had an old test version open and didnt realise! sorted now. (also explains the code annotations).

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

Similar Threads

  1. Replies: 34
    Last Post: 08-09-2017, 09:57 AM
  2. How to fix Failure creating file Access 2010?
    By Deprecate in forum Import/Export Data
    Replies: 3
    Last Post: 01-27-2016, 08:28 AM
  3. Failure to Create file
    By arges86 in forum Import/Export Data
    Replies: 4
    Last Post: 02-20-2015, 02:30 PM
  4. Runtime error 3436 Failure Creating File
    By cuddles in forum Access
    Replies: 13
    Last Post: 07-21-2014, 08:03 AM
  5. Type Conversion Failure When Importing txt File
    By Eka1618 in forum Import/Export Data
    Replies: 15
    Last Post: 10-29-2012, 06:45 PM

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