Read Only.

  • Thread starter Thread starter paul wheeler
  • Start date Start date
P

paul wheeler

Hi,

ive designed a form with several fields in it. I want some
staff to be able to have access to it in read only whilst
others can change the data.

Ideally, i would like a button on the form that unlocks
the fields when a password is entered?

regards, Paul
 
Open the form in design view.
Set these properties to No:
AllowEdits,
AllowDeletions,
and possibly:
AllowAdditions.

Add a text box to the form, and set these properties:
Name: txtPassword
Input Mask: Password
After Update: [Event Procedure]

Click the Build button (...) beside this. Access opens the code window.

Private Sub txtPassword_AfterUpdate()
If Me.txtPassword = "Put the right password here" Then
Me.AllowEdits = True
Me.AllowDeletions = True
Else
MsgBox "Wrong. Go away"
Me.txtPassword = Null
End If
End Sub


(The name of the text box is not crucial.)
 
Don't go down the road of passwords tied to forms. Use the built-in
security that comes with Microsoft Access. Set up user-level security and
then you can decide, for every object in your database, what access folks
have. Based on thier userid or 'group' you can decide who can view, change,
delete, add data. You can decide who can view forms, modify them, etc. You
can decide what queries people can see.

Setting up passwords all over the place that must be entered everytime a
user needs to do something special is just poor design. The passwords get
shared with others, they must be stored in code and can be found, they
require the same user to enter them many times a day if they have to edit
data often.

Let people idetify themselves once when they open the program and you decide
what access they hae at that time.

Rick B
 
thank you for this response. however, when i set the form
properties to No as detail, this also locked the password
text box too. i tried to set allowadditions to Yes to see
if that unlocked the password text box but it didnt.

at the moment i am able to lock the form to stop
unnecessary additons and deletion but am unable to enter a
password to unlock all fields... grateful for any help...

Paul
-----Original Message-----
Open the form in design view.
Set these properties to No:
AllowEdits,
AllowDeletions,
and possibly:
AllowAdditions.

Add a text box to the form, and set these properties:
Name: txtPassword
Input Mask: Password
After Update: [Event Procedure]

Click the Build button (...) beside this. Access opens the code window.

Private Sub txtPassword_AfterUpdate()
If Me.txtPassword = "Put the right password here" Then
Me.AllowEdits = True
Me.AllowDeletions = True
Else
MsgBox "Wrong. Go away"
Me.txtPassword = Null
End If
End Sub


(The name of the text box is not crucial.)
--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

ive designed a form with several fields in it. I want some
staff to be able to have access to it in read only whilst
others can change the data.

Ideally, i would like a button on the form that unlocks
the fields when a password is entered?

regards, Paul


.
 
Yes, of course, it does lock that also.

Your choices are to create another form to pop up and enter the password, or
else to set the Locked property of each of the relevant controls on the form
instead of the AllowEdits property of the form.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

paul wheeler said:
thank you for this response. however, when i set the form
properties to No as detail, this also locked the password
text box too. i tried to set allowadditions to Yes to see
if that unlocked the password text box but it didnt.

at the moment i am able to lock the form to stop
unnecessary additons and deletion but am unable to enter a
password to unlock all fields... grateful for any help...

Paul
-----Original Message-----
Open the form in design view.
Set these properties to No:
AllowEdits,
AllowDeletions,
and possibly:
AllowAdditions.

Add a text box to the form, and set these properties:
Name: txtPassword
Input Mask: Password
After Update: [Event Procedure]

Click the Build button (...) beside this. Access opens the code window.

Private Sub txtPassword_AfterUpdate()
If Me.txtPassword = "Put the right password here" Then
Me.AllowEdits = True
Me.AllowDeletions = True
Else
MsgBox "Wrong. Go away"
Me.txtPassword = Null
End If
End Sub


(The name of the text box is not crucial.)

ive designed a form with several fields in it. I want some
staff to be able to have access to it in read only whilst
others can change the data.

Ideally, i would like a button on the form that unlocks
the fields when a password is entered?

regards, Paul
 
Back
Top