Check box to prevent updates

  • Thread starter Thread starter TsM
  • Start date Start date
T

TsM

Hi, Thanks for any help I get on this.
I have a check box on a form, if all issues are resolved
on the form, the user is to check the box, at which point
all data on the form is locked. The only way to make
changes is to uncheck that one control.
I have tried to tag the check box, and then write code to
lock the fields if they dont have that specific tag,
however all I get is that this object doesnt support that
property type.

Suggestions ?
Thanks.
 
Sub Lock_all_but_CheckBox_if_checked
dim c as control
for each c in me.controls
if me.ckboxEverythingComplete = True Then
if c.tag <> "CheckBox" then
c.locked = true
Else
c.locked = False
Next
End if
End if
End sub

I placed "CheckBox" in the tag property of the Checkbox
control so that the code would NOT lock that control, As
if it did, there would be no way to uncheck it and allow
the user to go back in and update.
 
TsM said:
I have a check box on a form, if all issues are resolved
on the form, the user is to check the box, at which point
all data on the form is locked. The only way to make
changes is to uncheck that one control.
I have tried to tag the check box, and then write code to
lock the fields if they dont have that specific tag,
however all I get is that this object doesnt support that
property type.

Your code is probably trying to lock every control (except
the "tagged" ones and getting the error because some
controls (labels, buttons, etc) don't have a Locked
property.

You should check each control's ControlType property and
only try to lock the ones that can be locked.

An alternative, but quick and dirty, way around it is to use
an On Error Resume Next to ignore the error, but if you're
not careful with this, you may end up ignoring errors that
should be dealt with more carefully.
 
Back
Top