Strange lock behaviour

Buckmac

New member
Local time
Today, 00:10
Joined
Dec 4, 2003
Messages
6
I am confused! In fact, that is an understatement.

On my primary form, I have AllowEdits set to no on the properties page under the data tag.

When I open the form, I cannot edit any fields (which is what I want) and all command/toggle buttons work as intended.

I have a command button called Edit whose purpose is to allow me (or approved users) to update the data fields. This button gives rise to a Me.Form.AllowEdits = True

I can now edit my fields.

I then use the button to go back to locked mode (the caption changes to reflect current state). At the end of this I do a requery on the form to ensure that this takes. The fields are now locked.

However, and here's the problem, the 4 toggle buttons are also locked!! The command buttons are fine, but the toggle buttons fail to perform. If I unlock again, then, while unlocked, the toggles work.

Why this behaviour? If it's a function of the AllowEdits = False, then why do the toggles work initially on a form which has No Edit set as default?? This works only on the fields, but the AllowEdits = False affects the toggles too.

Help!!!

Cheers, Chris B
 
I'm not too sure why you are having that problem, but here may be a solution. This cycles through every control on the form.


Dim ctl As Control

For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
ctl.enabled = True
ctl.locked = False
End If
Next ctl
 
Thanks for that - I'll have to do some translation in order to try it. I think I can see where you're coming from - only changing the text boxes.

However, perhaps I should have mentioned that I'm using Access 2002 since you're solution won't fly in it.

I'll let you know how I get on.

Cheers, Chris B
 

Users who are viewing this thread

Back
Top Bottom