Results 1 to 6 of 6
  1. #1
    John Southern is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    31

    Transfer data to excel

    I have a select query in access and I need to transfer the results to Excel using VBA code.

    There seem to be two commands that are designed to achieve this


    DoCmd Transferdatabase and DoCmnd Transfertoexcel. I have been unable to find what arguments are required and generaly how to code this. Can anyone help please.
    John

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Have you looked in VBA help?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    John Southern is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    31
    Thanks for the attachment, it has more details than were available to me. Eg the three types of transfer and more spreadsheet types. ( Am I right in assuming that 9 is Excel 2007?)
    I am still very unsure how to give the path and file name to the SELECT query I need to export to excel. I also want to make sure that every time the proceedure is run the data replaces that already in the spread sheet. When I have used the export wizard it generates a new workbook!
    John

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Quote Originally Posted by John Southern View Post
    Am I right in assuming that 9 is Excel 2007?
    No, that is from Access 2000. Again, have you looked in Help? There should be examples with the syntax.

    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qryEquipListTSA", "\\ServerName\Users\Blah\TSAExport.xls"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    John Southern is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    31
    I have entered the following code :-

    DoCmd.TransferSpreadSheet acexport, acSpreadSheetTypeExcel10, "Qryalldata", "U:\Everybody\Sales statistics\Sales report.xlsm"
    I get the following error,
    Could not find installable ISAM (Error 3170)

    Using the Help key showed two possible reasons
    a) The ISAMs have been moved.
    b) A network link is not available.

    a) is unlikely I didnt know I had ISAMs!
    b) I am working on a networked machine. The application and data are on the file server. Excel is on my workstation.

    I have succesfuly exported the data using the wizard, I would suppose that the wizard needs the ISAMs as much as I do.
    John

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Just in case, try it with the normal "xls" extension.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. form data transfer to a report
    By poppinggizmo in forum Forms
    Replies: 1
    Last Post: 06-06-2010, 09:00 PM
  2. Data transfer and Mysql
    By fsmikwen in forum Programming
    Replies: 1
    Last Post: 02-25-2010, 11:42 PM
  3. Transfer data from ListView to Table
    By Zyckie in forum Access
    Replies: 1
    Last Post: 12-15-2009, 11:23 AM
  4. Replies: 3
    Last Post: 04-23-2006, 09:09 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