User-level security using a module

hollering

Registered User.
Local time
Today, 12:52
Joined
Feb 15, 2005
Messages
38
I already posted this question in the Forms forum, but I thought I might be more likely to get an answer here. I apologize if this violates forum etiquette.

I have a module that authenticates users and controls who has full or read-only access to certain forms. My problem is this; things such as combo boxes and checkboxes that are meant to be used for any user are disabled in read-only mode.

I was thinking that I could use the tag property on my controls to establish which controls should always be enabled and then using my module to dynamically enable/disable the appropriate controls each time I load a form. Can anyone help me do this?

Basically all I really need to know is how to address the form in a module (since I can't use "Me.Controlname" and I don't know which form is being worked on until runtime. And also I don't want to lock records, since this won't allow other users to view the tables being used.

Also I don't want to use the Enable property because I don't want the data to be "greyed out". I could use the Locked property, but that poses the problem of multiple users trying to access the same table. So is there a way I can set certain fields to read-only without making the whole form read-only or locking the data?

By the way, I am working in Access 97

Here's a pseudo-code example of what I want

for each Cntrl in PassedForm.Controls
if Cntrl.Tag <> "AlwaysEnable" then
Disable Cntrl
end if
next
 
How to enable controls on a read-only form

Looks like I managed to answer my own question. For future reference, this is how I did it.

On my read-only form (which uses the AllowEdits property to disable user input) I simply built an event on whatever field I wanted to work with.

On GotFocus, the event sets the "AllowEdits" property to true. Then on LostFocus it sets it back to false.

I just got it working so I haven't thoroughly tested it, but so far it works great.

I'm leaving this up rather than deleting it in hopes it will help someone else.
 

Users who are viewing this thread

Back
Top Bottom