Set Focus Issues in Form VBA

PNGBill

Win10 Office Pro 2016
Local time
Tomorrow, 08:56
Joined
Jul 15, 2008
Messages
2,271
Hi, I have a subform that I have set some code in the on open event of the main form.

The code sets some controls (fields) to enabled = False but I get an error message about can't do this when the it is on focus.

How can I get it Off Focus when the main form is opened?

Can I set some cmd button to have focus and allow my code to work??
 
is this Me.Cmdname SetFocus ??

and where would this line go??

In my code for the subform but just before the lines that are causeing a problem or earlier in the groups of code about all sorts of things?
 
Put it in the same code where you want to disable things, but put it first so then nothing else has the focus.
 
Still had problem - searched on #2164 error and noticed reference to tab stop - they must all be set to No - the error is over.

On to the next hurdle:D
 

Users who are viewing this thread

Back
Top Bottom