Here is the text that describes how to use the setfocus command.
Code:
You can have VBA automatically move the cursor to any control on your form.
This can be handy when your code can anticipate where the user is most likely
to type next. You can have VBA position the cursor to the appropriate control
automatically so that the user can just keep typing and not move the cursor
on his own.
The same technique also lets you avoid error messages caused by trying to
disable (or hide or lock) the control that currently has the focus. The VBA
syntax for setting the focus to a specific control is
controlName
. ControlName.SetFocus
where
controlName is the name of the control to which you want to move
the cursor. For example, the following statement moves the cursor to a control
named
CCType on the form:
[CCType].SetFocus
What it does not tell you is how the command changes when the control is on a second form. Say you have two forms open and the cursor is at the bottom of the second one and you want it to go to the top of the first one.
How is the command
[CCType].SetFocus
changed?
Any help appreciated. Thanks in advance.
Respectfully,
Lou Reed