Results 1 to 4 of 4

Thread: Export Access Query To Multiple Excel Worsheets in 1 Workbook, HELP!

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2004
    Posts
    48

    Exclamation Export Access Query To Multiple Excel Worsheets in 1 Workbook, HELP!

    Hi Folks,
    I want to export a query that I have to an excel document. That is the easy part though. My client also wants it exported to where each particular buildings schedule is on it's own worksheet within the 1 workbook. Example Of what I'm working with is below


    Code:
    Select tblCalendar.date, tblCalendar.Event, tblCalendar.time, tblCalendar.Building from tblCalendar Where tblCalendar.date between #12/12/2005# And #12/25/2005#


    There can be any number of buildings that are scheduled for, so the number of worksheets (tabs) in the workbook needs to be variable and dicated by the result set.

    Essentially he wants each buildings schedule (tblCalendar.Building) to be on it's own worksheet within the one workbook. Does anyone know how to do this? My search has been unsuccessful as of yet. Any input is GREATLY appreciated!

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Export Access Query To Multiple Excel Worsheets in 1 Workbook, HELP!

    Moved to Office Development

    One way to do it would be to order the data, by simply extending the SQL like this (I assumed the order you would want for the other fields):

    Select tblCalendar.date, tblCalendar.Event, tblCalendar.time, tblCalendar.Building from tblCalendar Where tblCalendar.date between #12/12/2005# And #12/25/2005# Order By tblCalendar.Building, tblCalendar.date, tblCalendar.time, tblCalendar.Event

    You can then read this with your code, and if the Building is different to the previous, create a new sheet for it - and put all data on it until Building changes again.

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2004
    Posts
    48

    Exclamation Re: Export Access Query To Multiple Excel Worsheets in 1 Workbook, HELP!

    Do you have some code that might help guide me on my quest?

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Export Access Query To Multiple Excel Worsheets in 1 Workbook, HELP!

    What code do you have so far?

    It's much easier for me to add to your code than write it all.

Posting Permissions

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



Click Here to Expand Forum to Full Width