Pass The Test for Form Open (1 Viewer)

R

RNCIENG

Guest
This is for Access 97

I know how to password protect a database. What I would like to do it protect a form from specific users. In the days of old DB4 I knew how to do this. I had a table with the Users and their respective Codes and a list of all the forms. If the User had an "x" corresponding to a specific form, then user user was allowed in that form. If the "x" wasn't there the user was turned away with a msg something like "Entry Not Allowed, Please see Admin for Assistance".

I would like to do that in Access also.

What I've done so far is create the User table (tblUser). tblUser has 4 fields, indUSERID, strUserFN, strUserLN, strUserCode.

I then created another table, (tblPassTheTest). I have a couple of fields in there. indUserID, fEmpAvg, fEmpHrs, ect.

If the User, let's say, Roberta, has access to use fEmpAvg, then the field, fEmpAvg would have an "x". For the sake of this question, Roberta is allowed to user fEmpAvg but not fEmpHrs.

Now I have a couple of forms, frmEmpAvg and frmEmpHrs.

I thought about using an OpenArg for the forms, I thought about a SelectCase in the OnOpen event of the forms, but neither of these seem to be appropriate....Well actually it's me....not sure how to test if ROBERTA has an "x" in the field fEmpAvg in the table tblPassTheTest. How would I implement something to even determine it's ROBERTA opening the form then determine if she is even allowed to?

I'm aware of the security for Access, however this will be for a small company and they aren't interested in too much....I thought there was another solution.

I'm open to any Suggestions, Snipetts, or Growls....

Thanks for you help.
 

RichMorrison

Registered User.
Local time
Today, 13:53
Joined
Apr 24, 2002
Messages
588
When I make an app with several forms, I make a "Switchboard" form that contains command buttons that open other forms.

There is an example in the "NorthWind" demo database.

You can add code in the OnOpen event of the switchboard to verify which user can see which other forms. If a user is NOT allowed to see form "Joe", then the button that opens Joe is made invisible.
 
R

RNCIENG

Guest
Thanks for your suggestion.

I know about the Switchboard and other options, it's the code in the OnOpen Event of another form I was wanting help with.

If you could offer some suggestions on that code, I would certainly appreciate it.

Thanks in advance.
 

RichMorrison

Registered User.
Local time
Today, 13:53
Joined
Apr 24, 2002
Messages
588
you wrote
<<
I know about the Switchboard and other options, it's the code in the OnOpen Event of another form I was wanting help with.
>>

I don't understand "another form". All the code for managing who can see what will be contained in the OnOpen code of the switchboard form only.

RichM
 

Users who are viewing this thread

Top Bottom