Results 1 to 3 of 3
  1. #1
    maxCohen is offline Novice
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    1

    Macro Export Deletes it's Destination File

    I'm helping someone solve an Access 2007 problem. They have a macro that deletes the destination file it's exporting to and I can't figure out why.


    Some things I've tried:
    1. Saving and exporting the database as an Access 2000 database.

    2. Exported the macro to see the VBA code and there is no "kill" statement that would delete the file.

    3. Gave trusted permissions to the database because when I originally ran it (and the owner of the database ran it) got a 2950 error.


    Steps of the problem:
    1. Double click the macro

    2. Pop-up states: "The Microsoft Office Access database engine could not find the object 'DEMOFile.txt'. Make sure the object exists and that you spell its name and the path name correctly."

    3. Click "OK"

    4. Action Failed pop-up: Error Number 2950 (which I don't understand if it's been made trusted).

    5. Click "Stop All Macros"



    The file that the data is supposed to export to is deleted. It's not in the Recycle Bin, it's just gone.


    The Macro Design View:
    Action: TransferText

    Arguments: Export Fixed Width, QryDEMOFile Export Specification, qryDEMOFile, C:\VALIC\DEMOFile.txt, No, ,

    Transfer Type: Export Fixed Width (also fails with delimited)

    Specification name, table name, file name are all correct

    Has Field Names: No
    HTML Table Name and Code Page are blank

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Instead of macro try the VBA. Does the same issue occur? I don't use macros - harder to debug and less versatile.

  3. #3
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    did you check the actual spec? what's in it? I wonder if there's a discrepency between the fixed width method and the spec you're using??

    can you use transfertext() and overwrite an existing file? are you trying to ADD data to the end of an existing file? or overwriting it?

    are you SURE the path is correct?

    like June I suppose, I despise macros. other than the 2010 updates that were included like mail merge, I never use them either.

    as a side note, if all else fails you could try streaming it with I/O through vba.

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

Similar Threads

  1. Macro export to excel error
    By Andy_d in forum Import/Export Data
    Replies: 7
    Last Post: 04-15-2011, 09:54 AM
  2. Macro to export to excel
    By jlclark4 in forum Import/Export Data
    Replies: 5
    Last Post: 04-15-2011, 08:36 AM
  3. Import Excel File Using Macro?
    By oregoncrete in forum Import/Export Data
    Replies: 0
    Last Post: 04-05-2011, 12:26 PM
  4. File Export
    By Kencao in forum Import/Export Data
    Replies: 3
    Last Post: 02-01-2010, 05:27 PM
  5. How do you export a file with a unique file name
    By Budman42 in forum Import/Export Data
    Replies: 1
    Last Post: 10-15-2006, 06:10 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