Make read only mdb methods

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have made one mdb, in which I made a password type system, like when the
mdb is opened, it opens a form, where the user enters a password and it takes
it to SwitchBoard Form, if wrong password it exits mdb.

One user was using the mdb, he had the persmission to edit/modify/Add data.

Now I have to add one more password for another user. BUT he should not have
the persmission to edit/modify/add data. He should only read the Forms Data
and prints reports.

For doing this MY IDEA is that I will make a Seprate function like below and
will call on On Open Event of each Form :

Function NoPermissions()
If Dlookup("[PwPerson]","[PwTable]")="Ammer" Then
Me.AllowEdits=False
Me.AllowAdditons=false
End If
End Function


I may have set User & Group Permission to do this, BUT its late, as I have
already designed Password method form.

My question is that Is the Above method correct OR I should do in some other
easier way.

Please advise me the other methods which can be implemented to carry out the
above mentioned problem.

Regards.


Irshad.


----------------------
 
The biggest problem with your approach is that you are hardcoding a value
from a table into your code. Bid Bad No No.
A better approach is add a Security Level field to your table. Something
like:
10 = View Only
20 = Enter and Edit
30 = Enter, Edit, Delete
40 = Admin

You will also need a method to keep track of who is logged on. You can then
create a standard module that can be called from any form. For this, I would
suggest you put the reference to the subroutine in the open event of each
form:

If CheckSecurity(user) < 20 Then
MsgBox "You Do Not Have Permissions for This Form"
DoCmd.Close acForm, MyFormName, acSaveNo
End If

Where CheckSecurity would look up the user's access level and return it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top