Disable a checkbox

  • Thread starter Thread starter Amelia
  • Start date Start date
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??
 
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."
 
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
...
 
Back
Top