Results 1 to 4 of 4
  1. #1
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368

    Splitting a table into chunks

    I have a few tables, hundreds of thousands of records each, that I need to break into multiple new tables of 5000 records each due to upload constraints. How would I go about using a query or even VBA to get this done? Please and Thanks.

  2. #2
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    I'd do it with VBA, e.g.
    Code:
    (1Turn the Hourglass on. (Without thisyour program will just appear to be idle.)
    (
    2Turn Warnings off.
    (
    3Create a snapshot recordset of the source table.
    (
    4create a loop which ends after all records in the snapshot have been exhausted.
    (
    5Create an inner loop which
      
    (aDeletes the next target table, if it exists, and creates it a new one as a dynaset from a list of names or a dynamically created namee.gFile1File2File3,.... (An error will fire if you try to delete it and it does not existTrap that error and resume where the code left off.)
      (
    bCycle through the nth 5,000 records of the snapshotappending then recod by record (using AddNew Updateto the current target
    (
    6end of outer loop.
    (
    7Add an error exit which traps the error for deleting a non-existent file, as well as general errors.
    (
    8Turn the Hourglass on.
    (
    9Turn Warnings off
    You can do this with queries and joins, which I wouldn't advise because complex SQL strings would have to be built dynamically.

    The suggested fat-dumb-happy method will work fine. "KISS" (keep it simple stupid) methods always work well with modern PCs).

    The suggested method will take minutes, not hours to run.

    Don't ask for the specific code. That's you job. I will answer specific narrow questions.

  3. #3
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    Thank you. And regarding asking for code, me asking for code is like a blacksmith asking to borrow a weapon. It just isn't right. Direction was all I needed. this worked great. Thank you.

  4. #4
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Great. Many just blindly want the code. Bon chance.

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

Similar Threads

  1. Database Splitting
    By Matthieu in forum Access
    Replies: 8
    Last Post: 02-08-2010, 03:37 PM
  2. user level security and splitting access db
    By tomClark in forum Security
    Replies: 3
    Last Post: 02-06-2010, 04:28 PM
  3. Splitting a Database related questions
    By Matthieu in forum Forms
    Replies: 3
    Last Post: 11-17-2009, 10:49 AM
  4. Splitting a field to separate fields
    By Petefured in forum Programming
    Replies: 8
    Last Post: 06-08-2009, 04:11 AM
  5. problem in splitting Date and time fields
    By swaroop1012 in forum Queries
    Replies: 1
    Last Post: 11-22-2008, 11:29 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