Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2003
    Posts
    9

    Unanswered: Exporting recordset results into Excel

    Hi all. Does anyone know how to export all the results of a recordset in Microsoft Excel? I can output one value from the recordset into a cell using "range", but I can't export the all the information in one go. Any ideas?

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Hello
    If you could copy or collect your data into a table then you can use:
    DoCmd.OutputTo acOutputTable, TableName , acFormatXLS, path & FilenameName & ".xls"


  3. #3
    Join Date
    Oct 2003
    Posts
    9
    Thanks but I'm really trying to avoid creating table

  4. #4
    Join Date
    Sep 2003
    Location
    Caldes de Malavella, Spain
    Posts
    244
    You might like to have a look at "Pumping Data", a project on our website. It describes how to output the data from a recordset into Excel, subdividing the data into separate sheets.
    Andy Briggs
    Elmhurst Solutions Limited
    Database Development and Consultancy
    http://www.elmhurstsolutions.com

  5. #5
    Join Date
    Oct 2003
    Posts
    9
    Thanks Andy that did the trick. Although I would suggest that rather than using

    Col =65
    Row = 1

    Excel.Range(chr(col & Row).select
    Excel.Activecell = OrdersDef.Fields(x).name

    you use:

    Col = 1
    Row = 1

    Excel.cells(row,col) = OrdersDef.Fields(x).name

    Its much more efficient and gets around columns starting "AA"

  6. #6
    Join Date
    Sep 2003
    Location
    Caldes de Malavella, Spain
    Posts
    244
    Cheers for that Chris.
    Andy Briggs
    Elmhurst Solutions Limited
    Database Development and Consultancy
    http://www.elmhurstsolutions.com

Posting Permissions

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