Check to unlock

S

Steve

I would like to be able to check a check box and have
it "unlock" a number of other fields. A user would be
unable to enter info into these fields without having the
check box checked.

I am a newcomer to Access and have no idea where to
begin. Thanks in advance.
 
F

fredg

Steve said:
I would like to be able to check a check box and have
it "unlock" a number of other fields. A user would be
unable to enter info into these fields without having the
check box checked.

I am a newcomer to Access and have no idea where to
begin. Thanks in advance.
Steve,
I assume the [CheckBoxName] is not a bound control.
To unlock controls when the check box is checked, code the check box
AfterUpdate event:

If Me![CheckBoxName] = True Then
[ControlA].Locked = False
[ControlB].Locked = False
End if

I quess you would then want to uncheck the box when going to the next
record and return those other controls to Locked, so code the Form's
Current event:
Me![CheckBoxName] = False
[ControlA].Locked = True
[ControlB].Locked = True
 
J

Jim Allensworth

I would like to be able to check a check box and have
it "unlock" a number of other fields. A user would be
unable to enter info into these fields without having the
check box checked.

I am a newcomer to Access and have no idea where to
begin. Thanks in advance.

I would recommend that you use the Enabled property instead of Locked.
It is less confusing to the user because the control will be greyed
out. If it is just locked then they could enter it but not be able to
enter anything into it.

You could use a check box to toggle it by using code similar to the
following:

Private Sub chkEnableToggle_AfterUpdate()
Me.txtProduct.Enabled = Not Me.chkEnableToggle
Me.txtRecNum.Enabled = Not Me.chkEnableToggle
End Sub

This would toggle the two text boxes Enabled or Not Enabled depending
on the check box. You could substitute the names of your controls for
the ones here - as well as add more if needed.

- Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top