Very very light security

samonwalkabout

Registered User.
Local time
Today, 13:20
Joined
Mar 14, 2003
Messages
185
I have a large Access 2000 database and need to set up a very light security on it. All i need is to be able to specific if a form is edit or read only depending on the path taken to reach this form i.e if the user selects a viewer option or an edit option. I dont need any passwords or user levels and i dont want to create 2 versions of each form (locked and unlocked) as there are a large number already. The users path to the form would determine all locks true or false. This is only to protect against accidental editing of infomation. Any ideas?
 
for a simple solution have an unbound text box (not visible) that you populate with either "edit" or "view" as a part of opening the data form process.

In your data form, set an on open statement that looks at the text in the TB you've just created.

Something like;

If Forms!form1.Fcn = "Edit" Then
Me.LogID.Enabled = True
Else
Me.LogID.Enabled = False
End If
 
Yes i had similar thoughts on tagging with a hidden text box but how do i change the access level to the form whats 'logid'? Is there a built in control that can lock all the fields on a form?
 
Use your if statement to create the security.

The line would be along the lines of

me.NameofControl.enabled=false

This will prevent a user from typing in the listed control.

If you haven't got too many fields, follow the example and list them all. If there are too many, I'll try and amend some code to change all the controls
 
The simple answer is always the one that evades me. N

To do this for all of the fields, try

dim Ctl as control

For Each ctl In Me.Controls
If Forms!form1.NameOfUpdateFieldFromInitialForm = "Edit" Then
Me.AllowEdits = False
End If
Next
 
samonwalkabout said:
The users path to the form would determine all locks true or false.

Given the above, I'm not sure you need the whole hidden text-box step. If the form is opened via buttons, with separate buttons for "open in read-only" vs. "open with edit capabilities", couldn't you just add a line of code to the existing OnClick for each button that sets the form-level AllowEdits property to yes or no?

--Probably-Wrong Mac
 
Since you appear to be using a command button that is specific to how you want the form opened...

I suggest that you just use the DataMode option with the OpenForm Method.

'Open a form as read only
DoCmd.OpenForm "YourFormName", acNormal, , , acFormReadOnly

'Open a form to allow edits
DoCmd.OpenForm "YourFormName", acNormal, , , acFormEdit

'Open a form to allow new records
DoCmd.OpenForm "YourFormName", acNormal, , , acFormAdd

Check the help files for the OpenForm Method for more options.

HTH
 
Horay!!

Thats exactly what i was looking for just didnt know it existed!! Thanks for you help you have done it again !!
 

Users who are viewing this thread

Back
Top Bottom