Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabling a field in a form while its open

Status
Not open for further replies.

PortyAL

Technical User
May 13, 2005
126
GB
Hi

I have a form and I want to disable some fields depending on whether a check box on the form is ticked.

I've tried:

Code:
 Forms![formname].Controls(fieldname).Enabled = False

but I get an error message:

"Run-time error '2164':
You can't disable a control while it has the focus."


Any help would be greatly appreciated.

Thanks

AL
 
You can do it in the Current event of the form *and* the AfterUpdate event of the control that disables this control.

HTH RuralGuy (RG for short) acXP winXP Pro
Please respond to this forum so all may benefit
 
Excellent. Thanks for post back with your success.

HTH RuralGuy (RG for short) acXP winXP Pro
Please respond to this forum so all may benefit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top