Hi all,
Been stuck on this quite a while, here's the problem.
On each of my forms I have a Locked/Edit button pair to control the 'edit' status of the form's controls (and any subforms controls).
These buttons execute some generic code (used by all forms) which uses a For Each...loop to lock/unlock each (textbox, combobox, etc) control as necessary.
However for command buttons I have to use the Enabled/Disabled property. Unfortunately you can't disable a control that has focus and sometimes one of these buttons has the focus so the VBA code bombs out at this point.
So my question is twofold: Can I test a control for focus and then move the focus "somewhere else" in case of a positive result. The "Somewhere else" being any textbox, combobox, etc. on the form/subform - I can't explicity give a control name since the function is generic and used by many forms.
Thanks for any help.
Been stuck on this quite a while, here's the problem.
On each of my forms I have a Locked/Edit button pair to control the 'edit' status of the form's controls (and any subforms controls).
These buttons execute some generic code (used by all forms) which uses a For Each...loop to lock/unlock each (textbox, combobox, etc) control as necessary.
However for command buttons I have to use the Enabled/Disabled property. Unfortunately you can't disable a control that has focus and sometimes one of these buttons has the focus so the VBA code bombs out at this point.
So my question is twofold: Can I test a control for focus and then move the focus "somewhere else" in case of a positive result. The "Somewhere else" being any textbox, combobox, etc. on the form/subform - I can't explicity give a control name since the function is generic and used by many forms.
Thanks for any help.