How to currupt Access Database???

Hello All Experts,

I've to currupt Access Database so that no one can open it through MS-ACCESS but again I should be able to aceess the same Database using VB.

Who is Participating?
TimCotteeConnect With a Mentor Head of Software ServicesCommented:
How about this as a possibility, use file functions to open the mdb for binary access, grab say the first 20 characters and store these somewhere like the registry. Rewrite these characters with garbage. Access will then spit out the mdb if you attempt to open it as the header will be corrupt. When you run your application, simply rewrite the original section from the registry and use your application as normal. When the application terminates, write garbage back to the header. It won't prevent access opening the mdb whilst your application has it open (unless your app uses it exclusively) but it will prevent casual attempts to open it with access.
If you corrupt the db, it is corrupt to everyone, including VB.  Your only real option is to password protect the db with some long and weird password that your VB app knows, but nobody else will guess.

      I am not clear about your question. Do u wanna password protect your database or encrypt the data?


Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

ravininaveAuthor Commented:
No I don't wish to protect my db with password or I don't mean to currupt it.  I only wish that someone should not open it through Access.
rename it do databasename.DLL instead of databasename.MDB

you'll still be able to open it, but only if you actually know that it's a database instead of a .dll file.

the better way, of course, is to set a password.
ravininaveAuthor Commented:
No I think there is a some way over there.  Because I'd downloaded one Software from NET.  When I tried to open Access Database then It gives me a message that the db is currupted.  But it uses it in his application.  How I don't know.
ravininaveAuthor Commented:
Please tell me in details.  As it seems to be a correct way.
Actually, don't know if my $0.02 will make a difference, but I have found that the easiest thing is to follow dredge and just rename the extension.

However, I rename the extension to my initials so that I can easily track all such files.

The structure of the file is still the same, however, Windows and Windows apps (like Access) won't recognize it by it's structure, only by it's extension.

>No I think there is a some way over there.  Because I'd
>downloaded one Software from NET.  When I tried
>to open Access Database then It gives me a message that
>the db is currupted.  But it uses it in his application.
>How I don't know.

Did it say it was corrupt? Or did it say it was an unrecognized database format? That program you downloaded may be using a higher version of the Access database than your copy of Access. For example, you cannot open an Access 2000 database by using MS Access '97. Or, the program may be using a different type of database altogether.

Your objective is to prevent people from opening the database in Access, yet for the database to be still usable by your program.

Your best method of achieving this goal is not to corrupt your database, but rather to either use a database password, or to use user-level security and secure your database.

Adding a password to the database is a very simple solution, and your VB program can simply access the database with the password; and your end-users of your VB program would never even know about the password. It would function exactly as if there were no password on the database because your VB program takes care of it automatically in the programming. Yet, if a user attempts to open the database in Access, they will be prompted for a password and they cannot open it unless they know what that password is.

The downside to using the database password is that it is very easy to break. There are probably about 20 people here who can quite readily explain to you how to do this.

A better approach would be to secure your database, change ownership of all objects to a special user you create, revoke all rights from the Users Group, Admins Group, and the Admin User, and add a password to the Admin User. Give all rights to your special user. Then your VB program would simply open your database under your special user's identity; and again, your users would never know the difference, and they also would not be able to open it in MS Access.

-Dennis Borg
Hi, I like the changing of the header approach, but another possibility is to encrypt the entire database file using some encryption algorithm. This is functionally the same as changing the header, but it is a bit more secure, although the time required might be a bit excessive.

The error message that you are getting may indicate that the MDB you are attempting to open is really Access 2000, and you are trying to open it with Access 97.

ravininaveAuthor Commented:
Hi TimCottee,
I thins yr way is correct.  I'm trying with this.
Hi ravininave,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept TimCottee's comment(s) as an answer.

ravininave, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer
Per recommendation, force-accepted.

CS Moderator
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.