473,396 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

MS Access - How to split one large table into smaller tables by record count

I have a table in MS Access that has +17K of records. I am trying to break down that table into smaller tables of 500 records each. Using the following code, I am able to create the temp table, but I cannot reset the number of ID column. The ID column on the original table is an autonumber. I am trying to reset the ID field on the temp table so I can do a record search starting at 1 and going to 500.

The alter SQL that I have does not update/reset the temp table's ID column to 1. Any ideas?

Expand|Select|Wrap|Line Numbers
  1. Function SplitTables_Actual()
  2. Dim rs As New ADODB.Recordset
  3. Dim cn As New ADODB.Connection
  4. Set cn = CurrentProject.Connection
  5. Dim rowcount As Long
  6. Dim tblcount As Integer
  7. Dim i As Integer
  8. SQL = "SELECT * INTO tmp_Flush_Actual FROM BIG_Table"
  9. DoCmd.RunSQL SQL
  10. SQL = "ALTER TABLE tmp_Flush_Actual ALTER COLUMN ID COUNTER(1,1)"
  11. DoCmd.RunSQL SQL
  12. SQL = "SELECT count(*) as rowcount from BIG_Table"
  13. rs.Open SQL, cn
  14. rowcount = rs!rowcount
  15. rs.Close
  16. tblcount = rowcount / 500 + 1
  17. For i = 1 To tblcount
  18. SQL = "SELECT * into tmp_flush_Actual" & i & " FROM tmp_Flush_Actual" & _
  19. " WHERE ID <= 500*" & i
  20. DoCmd.RunSQL SQL
  21. SQL = "DELETE * FROM tmp_Flush_Actual" & _
  22. " WHERE ID<= 500*" & i
  23. DoCmd.RunSQL SQL
  24. Next i
  25.  
  26. End Function
  27.  
Aug 14 '13 #1
5 7559
Rabbit
12,516 Expert Mod 8TB
This is something you should not do. You are denormalizing your data and it will make future queries more complicated. Whatever reason made you think that splitting up the table is necessary can be accomplished using one table.

More info about normalization can be had in our normalization article: http://bytes.com/topic/access/insigh...ble-structures
Aug 14 '13 #2
TheSmileyCoder
2,322 Expert Mod 2GB
I agree with Rabbit. Keep it in a single table. If you need to you can always select a small subset of your table by using a query. Access will only pull the information needed to perform the query, and as such access will not pull down the entire table. Thus there is very little to be gained by this approach, and alot of time to be wasted.
Aug 14 '13 #3
jimatqsi
1,271 Expert 1GB
One more to chime in in agreement. 17K is not really so many records. Would you care to discuss the decision for splitting the data. I only ask because if it is a matter of performance you can problem solve any performance problems in a better way than splitting the data into various tables.

And if you do split, this would be a good time to reconsider how your keys are defined.

Jim
Aug 14 '13 #4
We are uploading data in an Excel spreadsheet, via an IE GUI that will not accept any file with more than 500 records.
Aug 15 '13 #5
Rabbit
12,516 Expert Mod 8TB
There's really no need to break up your table into multiple tables because of that. You can just create a query that returns 500 records at a time.
Aug 15 '13 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Good Man | last post by:
Hi there I'm developing a large web application. Part of this web application will be storing numerical chart data in a MySQL table - these numbers will be already calculated, and are just being...
3
by: Joachim Klassen | last post by:
Hi all, first apologies if this question looks the same as another one I recently posted - its a different thing but for the same szenario:-). We are having performance problems when...
0
by: elvin | last post by:
Okay - apologize in advance for the length, but I want to make sure all you knowledgeable and helpful people have all the details you need to hopefully point my newbie rear in the right direction....
1
by: atahim | last post by:
I have a master table with over 300,000 records that i need to split into 500+ smaller tables. I have a branch field in the master that i can use as an identifier. I even created a branch table...
4
by: Peter W Johnson | last post by:
Hi guys, I have a problem with a datagrid record count. Here is the code:- <snip> Public Class frmMerchantDeposit Inherits System.Windows.Forms.Form Dim myconnection As New...
8
by: Janelle.Dunlap | last post by:
My database is linked to external data from a single Excel spreadsheet. I currently have it so that the entire spreadsheet exports into one table, but really for the purpose of my database it will...
8
by: beretta819 | last post by:
Ok, so I apologize in advance for the wordiness of what follows... (I am not looking for someone to make this for me, but to point me in the right direction for the steps I need to take.) I was...
1
by: datapro01 | last post by:
X-No-Archive: Yes I have a questionabout reorging very large tables. Running DB2 8.1 Fixpack 6 on AIX 5.2 supporting Siebel. I've read through the docs I could find and the postings in this...
2
bugboy
by: bugboy | last post by:
Does the total number of rows in a table determine the amount of resources required for a query?.. or is it primarily determined by the number of rows used by the query? ..Does an INDEX mean it...
6
by: gershwyn | last post by:
I have a large table (~600,000 records) that needs to have a unique record number assigned to each number. The table itself is too large to add an autonumber field to directly, so I was trying to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.