Discussion Locked

Setting Passwords for Access 97

0 helpful
13 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have been writing a number of relatively simple databases in MS Access for a number of years, and had been using Version 2. I am now using Access 97 and tried to tackle a problem which I could not resolve in the earlier version, but still found nosolution.

My problem is trying to secure the databases with passwords, so that I can restrict access to data (read only etc.), or stop users mucking up form designs and the like. The databases are not being accessed via a LAN, but on a stand alone machine by a only one or two users. Several separate offices use the DB in a similar way, each with their own unique set of data.

I get the passwords to work okay, but then the passwords are automatically applied to all Access DBs on that machine. Also, when I copy the DB.mdb file onto their machine (or send it to them) the DB is no longer password protected. I understand that the PW profiles are contained in C:\windows\system\system.mdw, but even if I personally install the DB on their machine WITH that file too, they only need to get another copy of an original system.mdw file and the protection is removed.

Question:
Is there some way I can compile/package/write the protection into the actual DB.mdb file (presumably without the requirement to access the system.mdw file) so that I can send just the DB to them, and the protection works without upsetting any other DBs they might have on their machine?

13 replies

by glen_mcleod

No to your question. What you have to do is create a new workgroup (.mdw) file using the MS Access Workgroup Administrator, which should be found in your 'Program Files/Microsoft Office/Office' directory. Give it a unique name, as in 'MyApp.mdw'.
Once you've joined the new workgroup file, the next time you open access you can define users and groups, and remove the default 'Administrator' user. Just be sure that you've defined a user with those rights before hand, preferably you.

When your groups and users are defined, use the Workgroup Admiinistrator again to change back to the default system.mdw. Create a shortcut to your .mdb with the command line argument:

/wrkgrp c:\your path here\MyApp.mdw.mdw

This will force this instance Access to use your new workgroup file, but any other Access apps will still use the default workgroup.

This will get you started, but I'd suggest you read up on User-level security in Access, it'll give you some more information.

Glen

by glen_mcleod

Typo on the command line argument: I put in an extra '.mdw'.

And removing the 'Administrator' user will make your database unreadable to reguler (non-workgroup) instances of Access.

Addition: Once the workgroup is defined, you'll have to import all your tables, queries, modules, etc. into the new database for security to work.

Glen

by bob sellman

In addition to using a different MDW file than system.mdw (and eliminating the default administrator name), as suggested, there are some other things you can do to reduce problems.

The first is to distribute the application as an MDE file, not anMDB file. This is especially useful if you have a significant amount of VBA code in back of your forms. The MDE format does not let the user see any of the VBA code and limits the ability to change forms and reports.

A second more drastic move is to include code so that when the database starts up the ability to start up with (and bypass the autoexec macro) is disabled. Look in the Access help for info about this. I personally don't recommend this because you have to be sure that you don't include it in your development copy.

I'm going to assume that you have separated the database into two components, a front end and a back end. The back end would contain the data tables and the front end would be the the "application" database (forms, reports, queries, macros, modules, etc.). In the front end just link to the tables contained in the back end. This helps you to maintain and update the databases without any hassle, especiallly important since you mention that there are multiple copies of the database with different sets of data.

I also assume you have set the startup properties (under tools) so that the database window and standard menus are not available. This means that users cannot even unhide the menu if that option is not available on the menu (which it is on the standard menus).

by bob sellman

Answer #4 brings up a good point--write your own security into the application. I've done this on a few applications and now include it on many newer apps I write (or revise). Here are a few tricks I've learned:

1. Set up a UserList table containing the login ID, password, name, security level, plus columns for currently logged in (yes/no), last log in date, etc.

2. Design a simple form frmLogin that asks for UserID and password. When password is updated verify that it is correct from the UserList table. Allow 3 or so tries before forcing a quit.

3. When correct password/ID are entered, change logged in to yes and post the date/time logged in. Next use a dialog box to ask if the user wants to change his password (default to No). If yes is selected, then make two additional text boxes visible on frmLogin, one for new password and the second to retype new password. Make sure the two agree before updating the password.

4. Have two public variables, strUserID and strSecurityLevel, in which you write those values after a successful login. You can use strUserID to record the user's ID when he adds or changes a record, if you want. strSecurityLevel is used when opening a form (or report) to set controls to visible or not visible.

As suggested in Answer #4, you can also use the security level to set certain properties, so that the admin level could see the database window, for example, and have full menus.

by donq

Between Glen and Bob I think they have provided you with anything I might suggest.

I persoonally use the workgroup approach so each logged-on user can be identified and recorded invisible using CurrentUser(). This allows us to identify users messing up the business data.

by etoile

Thankyou for your responses - I am trying a number of them. Further to No.1 : I can't find the MS Access Workgroup Administrator where you suggest - any other likely places?
No.2 : Is there any way to convert MDE back to MDB format so as to work on it further, and similarly, how do you unhide the menus after altering the startup properties under Tools?

by m.r.chambers

I had the same problem just last year, and I posted basically the same question here, with prety much the same responses. I tried all the suggestions, but I ended up deciding to make my own security system, using a couple of baisc forms and some VBA code. Do you know VBA? If you do, you can try something like using an opening form that asks for the user's password (have different passwords for different levels of access: for example, you'll want one for yourself that with give access to everything, as well as some user-level access - just read only forms, etc). Behind the OK button, put some code, a casewhere would be the simplest (but pretty long and very ugly) that basically says " if password is this, set the properties of that formto readonly, noadditions...bla bla, or if the password is this, set the props to full access..." you get the picture. Adding new passwords and changing old ones using this method can be a bloody nuisance (I ended up just having 2 levels: mine and the user's, and didn't bother with changing the passwords - not the best thing to do, but it wasn't really important for my situation).

The major advantage to this method is that you can set as many or as few levels as you want, and set each property for each form EXACTLY as you want, and you don't have to fiddle around with workgroup files etc, which I found to be a pain. The major downside is that you have to do it all yourself and it can turn into a real nightmare.

It's your choice of course, but I'd recommend this (espcially if it's just a small DB for a small number of users).

Hope that helps, and if you have any other questions, just ask.

M.R.Chambers
mark.chambers@iamit.com

by m.r.chambers

Something i forgot: disabling the SHIFT+CLICK bypass: Response 2 made a VERY important point: I you're not careful, you can lock yourself completely out if you disable the bypass. What I did, I made a form that was only accessible in the Admin level access, with two options Enable and Disable the bypass. On the Disable button I put the bypass lockout code, on the Enable I put the opposite, so I could still have access to the code and other things that are locked out by the bypass-disabling code on the user's machine (my DB was on a standalone machine too). I can send you the two code segments for the enable and disable if you can't find them elsewhere. Just email me.

Cya

This discussion is closed to new replies.