Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144

    Access Export vs Output


    I created a macro to output a query as "txt" format, the results differ from using the "right'click export" method in that the macro txt is not delimited and the "export" method is . . . is there something special that needst be done to get the same result as the "export" method?

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Is it fixed width or delimited?
    Which Macro Action are you choosing?
    What arguments are you using with that action?

  3. #3
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144
    Hi Joe,

    Where do I look for fixed width or delimited?
    The Macro Action is "Output"
    The arguements are "Object Type = Query; Obj Name = Export Survey File; Output Format = Text files(*.txt) No selection for Encoding

    (Access 2003)

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Try using the "TransferText" Action instead of "Output". That is the one that mirrors the manual export action of a text file.
    Note that you will probably need to save an Export Specification to use with the TransferText action.
    Creating one is easy.
    If you manually go through the process of exporting, you will work through the Export Wizard. When you get to the last step of the Export, before clicking "Finish", click on Advanced, and then "Save As" as give the Export Specification a name. This is the name you will want to use in the Export Specification argument of the TransferText action.

  5. #5
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144
    Ok, I went through and created everything for the TransferText. I copied and pasted a text file and removed the records so I could use this as a template. The macro runs, but returns an error that it cannot update. Database or object is read-only . . which it is not and then it deletes the txt template.

  6. #6
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I copied and pasted a text file and removed the records so I could use this as a template.
    I am not sure I understand. The process should export your data to a new text file.
    Where is this "template" coming in to play?

    What are your arguments for your TransfersText action (that is, what are you filling in for these values)?

  7. #7
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144
    Transfer Type = Export Delimited
    Specification = Export as delimited text
    Table Name = qryFinalPatientEmailList7
    File Name = full path of where file is located. The action argument states to "Enter the full path of the text file to import from, export to, or link to. Required argument.

    I thought this process was similar to the TransferSpreadsheet function that relates to an existing spreadsheet. I wanted to create a new text file and is why I selected the Output method.

  8. #8
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Your arguments look OK.
    TransferText transfers to a new text file, not an existing one. If you choose the name of an existing file in the "File Name" argument, I think it will simply overwrite the old one.

    It sounds to me like maybe you got that error message because you were trying to overwrite an existing file, but maybe you had that file open at the time (or someone else did). You cannot overwrite a file that is currently open/in use.

  9. #9
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144
    A little confusing.. . this requires a File Name . . . won't execute without it.

  10. #10
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Of course it does. Every file needs a filename. It needs to know where to save it.
    If you choose an unused file name, it will save it as that. If you choose the same name each time, it will keep overwriting the file.

    If you want different file names each time, you can convert the Macro to Visual Basic and make a dynamic file name (i.e. maybe something that incorporates a date/time stamp).

  11. #11
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144
    I tried all approaches. . . a name that did exist was deleted.. . and converting to VBA and a new name of a file . . . returned the error message I mentioned above, yet Access was not opened as a "read-only" and if it is a new excel workbook, how can a read-only error message happen?

  12. #12
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    If you are exporting from Access to a Text file, where does Excel come in?
    Can you open the original query you are exporting from without any issues?
    Can you manually export the query without any issues?

    The only other thing I can think of is that your Access database is corrupt, in which case you might need to repair or import all the objects to a new database.

  13. #13
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144
    Ok thanks for your help.

  14. #14
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    If you still cannot figure it out, you can always upload your database and we can take a look at it.
    Just let us know the name of the Macro you are trying to run when you upload it.

  15. #15
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144
    Sorry Joe, I neglected to answer your questions: 1) yes qry exports fine manually; 2) didn't mean to say excel workbook, mean to say txt file. I think you're correct regarding the db being corrupted, I've had a lot of other issues that are very odd. Thanks again.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Export Filtered ListBox output to a Excel Sheet
    By gokul1242 in forum Programming
    Replies: 4
    Last Post: 10-11-2012, 02:19 PM
  2. MS Access to Excel Output
    By rjbautista20 in forum Programming
    Replies: 7
    Last Post: 02-22-2012, 07:23 PM
  3. Replies: 1
    Last Post: 02-19-2012, 06:29 PM
  4. Replies: 4
    Last Post: 01-05-2012, 08:31 PM
  5. Querry IIf Output Format (Access 2003)
    By Bruce in forum Access
    Replies: 2
    Last Post: 12-03-2009, 06:52 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