Wait, now I'm confused. I thought you were disabling controls from the
command button's click event. If that's the case, the command button should
still have the focus. If you're disabling controls from one of the control's
own AfterUpdate events, you should set focus somewhere else that makes sense
to the user, like a command button. The choice of where to set focus is
purely a matter of usability.
Barry
ghillie5150 said:
Any suggestions where? I seem to have it working by setting focus
[beforeupdate] to the same command button. I guess the error is only
generated by having the cursor in a control holding data. Havent finished any
UAT on it. Do you forsee a problem?
Barry Gilbert said:
Yes, you'll need to set focus to another control first.
Barry
:
I'm getting run-time error 2164 "You can't disable a control while it has the
focus." It is referring to the afterupdate code that you had me put in.
Should I pre-empt this code with a setfocus?
Thanks
ghillie
:
Oops. Yes, it was a tyop.
Barry
:
Thanks for your response. I may be interpreting this wrong, but why are you
alternating the True/False from textbox to textbox? Is it a typo.
:
In the button's click event, enter:
Me.Textbox1.Enabled=True
me.Textbox2.Enabled=False
etc.
I the form's AfterUpdate event, do the reverse:
Me.Textbox1.Enabled=true
etc.
HTH,
Barry
:
Hey,
I would like to lock out a subform until a button is clicked. This is a
data entry form based on a query. The button will disolve the lock/disable
for a single record's data entry. Once that record's data is entered, I would
like the form to re-lock/disable. It also has to be locked upon open and ...
oh yeah, it is on a tabcontrol. Hopefully this will not make the solution
anymore complex.
Thanks for your time,
Ghillie