How to lock a check box once selected

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I have created a form in Access 97 with a check box for someone to select
that I do not want them to be able to change, for any reason, once it's
checked. Can anyone help explain how I would put in the coding to lock this
field when it's checked?

Any help would be greatly appreciated! Thanks in advance!
 
I have created a form in Access 97 with a check box for someone to select
that I do not want them to be able to change, for any reason, once it's
checked. Can anyone help explain how I would put in the coding to lock this
field when it's checked?

Any help would be greatly appreciated! Thanks in advance!

I assume you want it to open as unselected.
Code the Check Box AfterUpdate event:
Me![CheckBoxName].Locked = Me!CheckBoxName = -1

Place the same code in the form's Current event.
 
fredg said:
I have created a form in Access 97 with a check box for someone to select
that I do not want them to be able to change, for any reason, once it's
checked. Can anyone help explain how I would put in the coding to lock this
field when it's checked?

Any help would be greatly appreciated! Thanks in advance!

I assume you want it to open as unselected.
Code the Check Box AfterUpdate event:
Me![CheckBoxName].Locked = Me!CheckBoxName = -1

Place the same code in the form's Current event.

Thanks for the help! I tried that and it worked however it locked it for
all records as long as the form was open. I was able to close the form and
reopen it and check another box but then it locked that field again for all
records. Do you have any suggestions to have the coding lock only the check
box for that particular record only?
 
fredg said:
I have created a form in Access 97 with a check box for someone to select
that I do not want them to be able to change, for any reason, once it's
checked. Can anyone help explain how I would put in the coding to lock this
field when it's checked?

Any help would be greatly appreciated! Thanks in advance!

I assume you want it to open as unselected.
Code the Check Box AfterUpdate event:
Me![CheckBoxName].Locked = Me!CheckBoxName = -1

Place the same code in the form's Current event.

Thanks for the help! I tried that and it worked however it locked it for
all records as long as the form was open. I was able to close the form and
reopen it and check another box but then it locked that field again for all
records. Do you have any suggestions to have the coding lock only the check
box for that particular record only?

Regarding ...
a check box for someone to that I do not want them to be
able to change, for any reason, once it's checked. <

Did you do this part also?
If you place the same code in the Current event, if the check box is
not checked you will be able to check it. As long as you are on the
same record then, once checked you can not change it.
However, upon going to the next record, if the check box is checked
you can not change it.

Isn't that what your original post asked to do?

If the check box is not checked, you can check it. Then it's locked.
That's what you wanted.

But you have to place the same code in the Current event.
 
fredg said:
On Sat, 20 Mar 2004 00:01:30 GMT, Dave wrote:

I have created a form in Access 97 with a check box for someone to select
that I do not want them to be able to change, for any reason, once it's
checked. Can anyone help explain how I would put in the coding to lock this
field when it's checked?

Any help would be greatly appreciated! Thanks in advance!

I assume you want it to open as unselected.
Code the Check Box AfterUpdate event:
Me![CheckBoxName].Locked = Me!CheckBoxName = -1

Place the same code in the form's Current event.

Thanks for the help! I tried that and it worked however it locked it for
all records as long as the form was open. I was able to close the form and
reopen it and check another box but then it locked that field again for all
records. Do you have any suggestions to have the coding lock only the check
box for that particular record only?

Regarding ...
a check box for someone to that I do not want them to be
able to change, for any reason, once it's checked. <

Did you do this part also?
If you place the same code in the Current event, if the check box is
not checked you will be able to check it. As long as you are on the
same record then, once checked you can not change it.
However, upon going to the next record, if the check box is checked
you can not change it.

Isn't that what your original post asked to do?

If the check box is not checked, you can check it. Then it's locked.
That's what you wanted.

But you have to place the same code in the Current event.
Dave,
A thought just occurred to me after reading someone else's similar
post.
Your check box is bound to a field in a table, isn't it?
 
Did you do this part also?

If you place the same code in the Current event, if the check box is
not checked you will be able to check it. As long as you are on the
same record then, once checked you can not change it.
However, upon going to the next record, if the check box is checked
you can not change it.

Isn't that what your original post asked to do?

If the check box is not checked, you can check it. Then it's locked.
That's what you wanted.

But you have to place the same code in the Current event.

From his followup post, it sounds like he wants it be "per record".
Meaning, once you set it to true, you can never change it again for
that record.

Your example works, but will set the locked property for the checkbox
for the remainder of the records as long as the form is open.

He actually needs to toggle the locked property on or off on each
current record depending on if the value is true or false, such as:

If Me![CheckBoxName] = True then
Me![CheckBoxName].Locked = True
Else
Me![CheckBoxName].Locked = False
End If
-D
 
fredg said:
fredg said:
On Sat, 20 Mar 2004 00:01:30 GMT, Dave wrote:

I have created a form in Access 97 with a check box for someone to select
that I do not want them to be able to change, for any reason, once it's
checked. Can anyone help explain how I would put in the coding to
lock
this
field when it's checked?

Any help would be greatly appreciated! Thanks in advance!

I assume you want it to open as unselected.
Code the Check Box AfterUpdate event:
Me![CheckBoxName].Locked = Me!CheckBoxName = -1

Place the same code in the form's Current event.

Thanks for the help! I tried that and it worked however it locked it for
all records as long as the form was open. I was able to close the form and
reopen it and check another box but then it locked that field again for all
records. Do you have any suggestions to have the coding lock only the check
box for that particular record only?

Regarding ...
a check box for someone to that I do not want them to be
able to change, for any reason, once it's checked. <

Did you do this part also?
If you place the same code in the Current event, if the check box is
not checked you will be able to check it. As long as you are on the
same record then, once checked you can not change it.
However, upon going to the next record, if the check box is checked
you can not change it.

Isn't that what your original post asked to do?

If the check box is not checked, you can check it. Then it's locked.
That's what you wanted.

But you have to place the same code in the Current event.

My mistake! I think I forgot the last part, once I keyed that it worked
perfectly!

Thanks for all of your help!
 
Back
Top