Disable a checkbox

A

Amelia

Okay, I have an inventory form. Once an item is sold I have a check box that
is to be checked and then it opens a new form that I can enter who it was
sold to etc...

What I want to do is disable the check box once it is set to true. I have
tried entering this in the after update property event:

If Me![Sold] = yes Then
Me![Sold].Enabled = no
Else
Me![Sold].Enabled = yes
End If

But it errors: Run time error 2164, You can't disable a control while it has
the focus. Okay, I understand that . But then where can I put the code so it
disables the check box and disables it for only that record??
 
A

Al Campagna

Amelia,
Please see my response to your later posting of this same question,
in this NG.
Try to avoid posting the same question twice.
Responders are volunteers, and responses times are usually very good,
but not guaranteed.

--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
S

Stuart McCall

Amelia said:
Okay, I have an inventory form. Once an item is sold I have a check box
that
is to be checked and then it opens a new form that I can enter who it was
sold to etc...

What I want to do is disable the check box once it is set to true. I have
tried entering this in the after update property event:

If Me![Sold] = yes Then
Me![Sold].Enabled = no
Else
Me![Sold].Enabled = yes
End If

But it errors: Run time error 2164, You can't disable a control while it
has
the focus. Okay, I understand that . But then where can I put the code so
it
disables the check box and disables it for only that record??

Just set the focus to another control on the form first:

Me!ControlName.SetFocus
If Me![Sold] = yes Then
...
 

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