Click here to Skip to main content
15,558,870 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:

I have an app which requires mdb files to function.

If I delete data, the size of the mdb file doesn't go down.
I know there are ways to compact mdb files, but I want to create a new
mdb file and also to create a single table with a single colunm and with no index.

Can anyone tell me how to do that?

What I did recently (yesterday to be honest) was:

1. Create an empty MDB file with Access ("empty.mdb").

2. Add the empty MDB file as a resource to my executable. This makes the file accessable as a byte[] array.

3. Whenever I need an empty MDB file, I simple access the byte array and write it as an MDB file to the required destination path on my disk.

4. Then, I can create the tables I want by executing SQL scripts on the new MDB database.
Share this answer
hey thanks for the reply!

I tried it and it works like a breeze. :)
The only think is that I'll need to provide a separate dll.
Thats a complete no-no for the boss! :(

isn't a portable way to do that?

I have heard that you can combine exe and dlls.
is that true?
Share this answer
Sandeep Mewara 1-Aug-10 10:22am    
Reason for my vote of 1
Not an answer. Either use 'Improve Question' link to update your question OR use 'Add comment' feature to respond to an answer. Don't hit answer button when actually it is not an answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900