Results 1 to 3 of 3

Thread: Access to Excel

  1. #1
    Join Date
    Sep 2003
    Posts
    2

    Unanswered: Access to Excel

    Hi all,

    I have some make table queries that pull specific data from my database. I also have reports that refer to these tables so I can produce hardcopies of the desired data.

    What I would like to do is set up my database so that when I run these make table queries it opens/saves the data into an Excel spreadsheet.

    Is this possible? Would I need to do it from a form?

    Cheers,

    - Iain

  2. #2
    Join Date
    Feb 2003
    Location
    Auckland, NZ
    Posts
    150
    YOu cna use a form and run the query and the excel export froma button or you can write a macro if you do not want to write code. You will be using the Transferdatabase function. The only problem I see with a macro is that you will have to manually change the excel filename if this is required.

    Or you can write code and use the common dialog activex control to specify the file name.

    Short answer to your question:

    Yes it is possible.
    JJ Kennedy
    Double J IT Solutions
    www.doublejit.co.nz

    VB 6, VB.NET, ASP.NET, MS SQL Server, MySQL, MS Access

  3. #3
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326

    Access To Excel

    You can do this with both DoCmd.TransferSpreadsheet, DoCmd.TransferDatabase.

    I prefer a more controlled approach by using the Excel Object through code. The Excel Range object exposes a method called .CopyFromRecordset that works well.

    The following link can get you started:
    http://members.rogers.com/homerboo/A...O%20EXCEL.html
    All code ADO/ADOX unless otherwise specified.
    Mike.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •