Go to a specific controll when open a Form

P

Peter

Hi all again and thanks for all great support i received at this place!

When opening a form i wish to go to a specific controll (in this case a
unbounded combox in the form header)...is this an event in the On Open...or?

Ciao!
 
R

RonaldoOneNil

On Open is fine, but if your form is used to display and move through several
records and you want to go to this control everytime you change record, then
On Current event is better.

[ComboBoxName].SetFocus
 
P

Peter

Thanks, you make a good point there. Will try that one too.

RonaldoOneNil said:
On Open is fine, but if your form is used to display and move through several
records and you want to go to this control everytime you change record, then
On Current event is better.

[ComboBoxName].SetFocus

Peter said:
Hi all again and thanks for all great support i received at this place!

When opening a form i wish to go to a specific controll (in this case a
unbounded combox in the form header)...is this an event in the On Open...or?

Ciao!
 
K

Ken Snell MVP

Open event of a form is not a good place to put code to set focus to a
specific control. Controls usually are not instantiated yet during the Open
event.

I usually use Load event, and make the SetFocus step the last step in the
code procedure.

As noted elsethread, Current event also is useful if you want to do the
SetFocus each time you move from one record to another.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top