Results 1 to 2 of 2
  1. #1
    dfaulkner1 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2015
    Posts
    5

    Auto splitting a Query from Access to separate Excel spreadsheets

    Hi

    I am trying to set my database so when I click on a button, it will autosplit a query that I have into separate sheets based on "Ledger".

    Here is an example piece of data

    Ledger Account Account Name Title Forename Surname Email Date
    1 01TARENV Tardis Environmental Mr John Jones jj@aol.com 17/07/2015
    1 01STARBE Starbeach Ms Kim Newton Kim@starbeach.com 18/07/2015
    4 04HOLLA Holla Mr James Smith jamessmith@holla.co.uk 22/07/2015
    5 05DUMFRE Dumfree Mr Harry Dean Hdean@gmail.com 20/07/2015


    So in one Excel sheet I would need all Ledger 1's, another sheet I would need all ledger 4's...

    I need this automated as there is a lot of data and we will be running this every other day



    Any help?

    Thanks

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    In order to automate the process you will need to build code to iterate the records and create worksheets for the various Ledger groups. VBA can be used to automate Excel and create a new workbook. As the VBA loops through the records it can determine the value of ledger and create a new worksheet for each value. With each new worksheet, I would use the CopyFromRecordset method to import the data. The iterative statement would dynamically parameterize the query for the CopyFromRecordset method.

    https://msdn.microsoft.com/en-us/lib.../ff839240.aspx

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

Similar Threads

  1. Replies: 1
    Last Post: 11-21-2013, 10:28 AM
  2. Replies: 1
    Last Post: 07-31-2013, 06:39 PM
  3. Replies: 19
    Last Post: 07-29-2013, 09:11 AM
  4. Run Access code, from separate excel...
    By redbull in forum Programming
    Replies: 1
    Last Post: 10-16-2012, 08:50 AM
  5. Splitting a field to separate fields
    By Petefured in forum Programming
    Replies: 8
    Last Post: 06-08-2009, 04:11 AM

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