Access Security and VB 4.0 
Author Message
 Access Security and VB 4.0


>I posted the following and still have received no help.

>I am distributing a VB 4.0 application with Access 7.0. Some files are,
>needless to say, private. How do I provide a password in my VB program to
>send to Access?

>I.E. I don't want a person to just be able to purchase Access and go look at
>the database. I only want to be able to open the database thru my VB program.

>If you receive an answer please follow-up to me and I'll do the same for you.


Found a solution on our own.

Everything is done in Access.

1. Create a Module. Call it "Security" for example.
   Enter Code:

        Function Security()

        strInput = InputBox("Enter Password:", "Password", 2000, 2000)
        If not Ucase(strInput) = "the password you assign" then
           Application.Quit acExit
        End If

2. Create a Macro called "Autoexec" (must be called "Autoexec")
   Action is "Run Code"
   Function Name "Security()"

This will enable a VB program to open the database without a password, but
will require any user opening the database under Access to supply "the
password you assign".

The only problem with this is that; if you have a sophisticated user (we
you can bypass the password by holding down the shift key when you open the
database in Access.

Also suggest (to really try to confuse them) that you hide the module in
Access by highlighting the Module, go to Tools;Options and change the View
property to Hidden.

Since you can open the database under VB 4.0 I don't think there should be a
problem opening it under Crystal Reports since all the security is when
opening the database in Access manually. (We use Crystal Reports 4.5).

If you would rather use user permissions I received this EMail from another

(0. Back up the database)
1. Start Access and seach help for "Security Wizzard" and follow the
instructions. Be sure to choose the "user level method".
2. You will end up creating a .MDW file, be sure to use a name
different from the default system.mdw file.
3. In VB (4.0 32 bits that is) use/set the following properties of the
DBEngine object: (only once will do)
SystemDB = "MDW filename including full path"
User =
Password =

Things are now set to use your encrypted and user level secured
database. You can still see what's in the DB (i mean what tables,
queries etc.) when you open access with another MDW file, but you
can't access the actual data in it or anything else.

If you are using Crystal 3.0 expect the problems i'm having: Crystal
is too stupid to open the database and read the information in the
tables....  Do you know if any newer versions of Crystal support
encrypted/secured Access databases?

Be sure to test what happens (can one access the database?) when some
hacker tries the following:
- deleting the .MDW file
- creating a new MDW file with the same name as your MDW file
- combination of the two above: deleting and then recreating the MDW

I didn't test this and would appreciate any feedback from you on this.
I suspect security is pretty tight, or at least tight enough to keep
the even more then average experienced computer user from peeking into
your DB. But remember; if some smart hacker really wants to enter your
DB expect them to succeed....

Michiel Magnee

Hope this helps.

Mon, 22 Mar 1999 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Access Database concurrent users in VB 4.0 application and Database Security

2. VB 4.0 and Access 2.0 security problem

3. HELP: Security: Access 7.0 with VB 4.0

4. Access Database concurrent users in VB 4.0 application and Database Security

5. SECURITY: VB 4.0 16-bit and Access 2.0

6. SECURITY: VB 4.0 16-bit and Access 2.0

7. NT 4.0 File Security & VB 4.0

8. Access 2000 Security VS. Access XP Security

9. having difficulty establishing security using VB 4.0(16-bit) and Jet 2.5

10. VB 4.0, CR 4.0, and MS Access 2.0 - a strange problem

11. VB 4.0 database access quits after installing NT 4.0 Server

12. App crashes - access violation - NT 4.0/VB 4.0(32 bit)/OLE Automation


Powered by phpBB® Forum Software