Open read only/password to modify

KEKeogh

Registered User.
Local time
Today, 18:03
Joined
May 4, 2011
Messages
80
OK, I tried to see if this was possible but not finding much of an answer. So I figured I'd check with our merry band of experts if it even is.

I'm using Access 2013 and I have a database I would like everyone to be able to see but only those that have a password to be able to change data.

Is there a way to even to do this? A code somewhere maybe?

I've been able to find the option to make the whole database password protected but that's not what I'm looking for.

Thanks
Kathie
 
you'll need to create a table of users giving their access rights. For what you want it needn't be complicated - something like

tblUsers
UserName
Password

should suffice

Next you'll need to create a login form - there are plenty of examples how to do this on this forum

Then for each form you need to to modify the allow edits property depending on whether or not the user has a password.

So when the user logs in to the application through the login form, the login form can store the fact they have a password in a public variable - lets call it HasPassword - of type boolean.

In each form open event you can then put

Code:
Me.Allowedits=HasPassword
 
Thanks, I'll give that a shot!

Looks like what I need.

Kathie
 
note that if you do this

Me.Allowedits=HasPassword

you will find that you cannot change any controls - combo boxes, check boxes, etc even if unbound, although you can click buttons.

You may prefer to iterate the controls and lock just particular controls. Try it and see.
 
OK So I've found a login form that works. Right now if you don't have a password it just won't let you in.

I'm not familiar enough with public variable and am having a difficult time with setting that up.

Still trying!

Kathie
 
I'm not familiar enough with public variable and am having a difficult time with setting that up.
Create a new module or use an existing module if you have one (Not a form module) and put just below the Option Compare Database line

Public HasPassword as Boolean
 
Great! Now to see if I can get it into the Login button correctly.

Kathie
 
THANK THE LORD!!! I finally got it working. Here I had the declaration of the variable in the wrong spot. As soon as I changed it, it works like a charm.

Thanks again CJ!

Kathie
 

Users who are viewing this thread

Back
Top Bottom