Me.AllowEdits disables Toggle button?

Meltdown

Registered User.
Local time
Today, 19:10
Joined
Feb 25, 2002
Messages
472
Hi all,

I have a form and i need to disable edits like so:
Me.AllowEdits = False

The problem is, it also seems to disable my toggle button, the code in the click event doesn't fire after I've set Me.AllowEdits = False. Command button are uneffected.

Is there a solution to this problem?

Thanks
Melt
 
The solution is to put a tag on every control you want locked and then use this code instead:

Code:
Dim ctl As Control

For Each ctl In Me.Controls
   If ctl.Tag = "lock" Then
      ctl.Locked = True
   End If
Next

So, in the controls you want locked just put in the Tag property lock and then it will be able to find it. And to unlock to edit you would use the opposite:

Code:
Dim ctl As Control

For Each ctl In Me.Controls
   If ctl.Tag = "lock" Then
      ctl.Locked = False
   End If
Next

You probably will need to include the Locking code in the Form's On Current event to make sure that it gets locked when moving to another record.
 
OK, thanks for that Bob.

Regards
Melt
 
yes its irritating - allow edits stops everything working - search boxes, combo boxes and so on - its not just bound fields - its anything.

shame really, it makes a bit more work!
 

Users who are viewing this thread

Back
Top Bottom