Results 1 to 4 of 4
  1. #1
    kestefon is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    108

    VBA to Export Queries to Text; Run-Time 3011 Error


    I'm trying to automate the export of some queries, but for some reason I'm getting an error message half-way through. The first two queries export perfectly fine, but then I start getting a "Run-time error 3011" for all of the other queries.

    Any ideas why this might be?

    Code:
    Dim timeStamp As String
    
    
    timeStamp = Format(Now(), "mmddyyhh")
    If Me.txtExportPath.Value = "" Then
    MsgBox "Export path not found"
    Exit Sub
    End If
    
    
    path = Me.txtExportPath.Value
    
    
    DoCmd.TransferText acExportDelim, "SpecExport", "Report1", path & "\Report1_" & timeStamp & ".txt", True
    DoCmd.TransferText acExportDelim, "SpecExport", "Report2", path & "\Report2_" & timeStamp & ".txt", True
    
    'Process fails with Reports 3 and 4.
    DoCmd.TransferText acExportDelim, "SpecExport", "Report3", path & "\Report3_" & timeStamp & ".txt", True
    DoCmd.TransferText acExportDelim, "SpecExport", "Report4", path & "\Report4_" & timeStamp & ".txt", True

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You are using the same export specifications for each query? Maybe one query does not like SpecExport

  3. #3
    kestefon is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    108
    Oh, duh. That was it, thanks!

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You bet...

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

Similar Threads

  1. Replies: 7
    Last Post: 12-10-2018, 05:24 PM
  2. Replies: 5
    Last Post: 07-24-2014, 07:54 AM
  3. Replies: 6
    Last Post: 12-21-2012, 02:21 PM
  4. run-time error 70 when importing text files from software
    By mejia.j88 in forum Import/Export Data
    Replies: 6
    Last Post: 06-05-2012, 04:10 PM
  5. Replies: 6
    Last Post: 10-14-2010, 08:33 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