Results 1 to 3 of 3
  1. #1
    DetrieZ is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    17

    SendObject Export CSV and Import CSV

    I have this code that works perfectly with XLS (Excel 2003) files, but now I need it to run CSV files

    This creates and attaches the file to an email


    Code:
    DoCmd.SendObject acSendQuery, "OutputNewRecords", acExportDelim, , , , "New Record Data - " & Now, "Here are the latest Records", True
    I've tried this but it still creates an XLS file
    Code:
    DoCmd.SendObject acSendQuery, "OutputNewRecords", acExportDelim, , , , "New Record Data - " & Now, "Here are the latest Records", True
    This imports the files
    Code:
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, strTableName, strFile, True
    Am I missing something simple?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I don't see anything different between the first two examples.

    You can try specifying the output format as acFormatTXT but I don't think SendObject method allows for comma separated text file. Might have to use alternate coding to save a file and then attach the file to message. Review: http://www.wiredbox.net/Forum/Thread...om_Access.aspx
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    DetrieZ is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    17
    Argh... sorry.. you're right

    the working code is
    Code:
    DoCmd.SendObject acSendQuery, "OutputNewRecords", acFormatXLS, , ,  , "New Record Data - " & Now, "Here are the latest Records",  True
    the code I tried but created an XLS file was
    Code:
    DoCmd.SendObject  acSendQuery, "OutputNewRecords", acExportDelim, , , , "New Record Data -  " & Now, "Here are the latest Records", True

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

Similar Threads

  1. Outlook Export Import Access
    By turk in forum Access
    Replies: 4
    Last Post: 07-17-2012, 07:31 AM
  2. export/import by email
    By sue tang in forum Import/Export Data
    Replies: 5
    Last Post: 03-14-2012, 04:41 PM
  3. Replies: 5
    Last Post: 10-28-2011, 12:20 PM
  4. Export / Import situation
    By svcghost in forum Import/Export Data
    Replies: 7
    Last Post: 10-14-2010, 04:23 PM
  5. Prompt for filename for import/export??
    By stephenaa5 in forum Import/Export Data
    Replies: 23
    Last Post: 10-23-2009, 03:43 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