Disable All Fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to diasable all Fields within a form once a toggle button has
been pressed.
 
You could set the AllowEdits (and AllowDeletions?) property of the form to
No in the AfterUpdate event of the toggle button.

If the button is bound to a field, you probably want to do the same thing in
the Current event of the form.
 
hi,
yes.
dim cntrl as control
for each cntrl in me.controls
if me.togglebutton1 = true
cntrl.enabled = false
else
if me.togglebutton1 = false
cntrl.enabled = true
end if
end if
next cntrl

this snipplet with disable all control on your form(textbox, combobox ect)
with the toggle is checked. i enables all controls when you uncheck. If You
diable a control, you must have a way to enable it.
i would put it in the togglebutton's click event.

Regards

FSt1
 
I have typed this in

Private Sub Toggle265_AfterUpdate()

Dim cntrl As Control
For Each cntrl In Me.Controls
If Me.Toggle265 = True Then
cntrl.Enabled = False
Else
If Me.Toggle265 = False Then
cntrl.Enabled = True
End If
End If
Next cntrl

End Sub

But it keeps on coming up with a error -

Run-time error '438':

Object doesn't support this property or method.

(cntrl.Enabled = True)
 
Back
Top