Proper way to create a temporary throw away table

OasisUnknown

New Member
Joined
Oct 15, 2015
Messages
46
Hello Community,

I have an access database that I am working on and is still in the beginning phases.

What I am dealing with is my database file size growing exponentially. I have narrowed this down to how I am creating and dropping a temp table.

here is what is happening.

I have an external database that I am accessing (I have no access to its data other than to pull queries and export that data to an excel file)

this file has many thousands of records that I need to analyze and build reports off of and this data can change but the number of columns will stay fixed at 78.


So what my plan was to export a fresh pull of the data from the external database into an excel file and then import that data into my access database with my custom reports and quiers built off that data.

what I am doing is I have a button for uploading this excel document and I select the excel file with the file dialogue

and then I import that data into a temporary table (I do this so I can error check it before I formally put it into my database)

the error check counts the number of columns and compares that to how many are required for import (78)

then it error checks the field names to ensure that it is in the correct order (col A is not switched with Col B)

after the error check is done I would delete all the data from my permanent table in my database
then transfer the new data from my temp table to the permanent table.

and then I drop the temp table because I don't need it any more until I import my next pull


but I have noticed through the many tests of the code that my database goes from around 16 megs to upwards of 100+megs
and then I need to compact and repair and then it goes back down to 16 megs


from all my research I have done online this seems to be because even though access drops the table the memory is not really released until a compact and repair is done.


my question is 2 part.

Am I creating and using a temp table in the correct way.

and 2.
if I am can I automatically compact and repair after the table is dropped or release that memory space manually somehow.


Thank you in advance for reading.
 
It's a lot of code to handle a simple task but it's all here:
MCCompact_DB

The main thing was to have lots of options (but in general there is also a default for everything).
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Looks cool, too bad I probably won't be able to use it (trying to get any kind of add-ins/downloads to happen in our environment is a difficult task with our Data Security Team - it is the reason I can't use HTML Maker!).
 
Upvote 0

Forum statistics

Threads
1,221,825
Messages
6,162,166
Members
451,750
Latest member
dofrancis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top