Results 1 to 4 of 4
  1. #1
    Giri.hb is offline Novice
    Windows 10 Access 2007
    Join Date
    Sep 2016
    Posts
    2

    need VBA code to split and export the table to multiple excel


    Hello Team,

    I have a table in the access which is having more than 10 lakh rows, So I need the code to export the data to excel by a specific range of rows. For example I need to export 65000 rows for some work book and 75000 or more for other work books. Please help me to get the code to split and export the data to the multiple work books at the earliest possible.

    Regards,
    Girish

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    The table that has the data must have an extra column called Exported.
    Make and run query, qsRecs2Export, that pulls TOP 65000 where EXPORTED = false.
    export this to exel file.

    Then run a query that runs an update using, qsRecs2Export, then sets EXPORTED = true
    this marks the data as exported and wont happen again.

    Then run qsRecs2Export again to get the next batch, and repeat until all records are marked true.

  3. #3
    Giri.hb is offline Novice
    Windows 10 Access 2007
    Join Date
    Sep 2016
    Posts
    2
    Hello ranman256,

    Can u please assist me on how to do this with step by step guide, since I am new to the access. Kindly do the need full, since its quiet urgent for me. Thank you.

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    put a field in your table boolean EXPORTED.

    build a query named qsRecs2Export,
    select TOP 65000 from table where EXPORTED = false.

    export this query using:
    transferSpreadsheet

    then run a query to mark the EXPORTED items as true, quMarkExported
    update qsRecs2Export set EXPORTED = TRUE

    PUT these 2 steps into a macro
    1. transerspreadsheet
    2. quMarkExported

    Then:
    Run the macro
    edit the macro , change the export workbook name
    then run the macro again
    repeat until ALL EXPORTED fields are true

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

Similar Threads

  1. Replies: 12
    Last Post: 12-17-2012, 12:47 PM
  2. VBA code to export from Access to Excel
    By DATADUDE28 in forum Access
    Replies: 1
    Last Post: 11-03-2012, 01:39 PM
  3. Replies: 2
    Last Post: 08-05-2012, 06:32 PM
  4. Replies: 2
    Last Post: 06-06-2012, 01:04 PM
  5. Export Table in Access 2007 to Multiple Workbooks in Excel 2007
    By hutchinsm in forum Import/Export Data
    Replies: 5
    Last Post: 03-01-2012, 05:23 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