Set A Field To Edit When Form Opens

J

Jeff G

Is it possible to have a field automatically set to edit when a form opens
(like pressing the F2 key)?

I suppose it can be done using SendKeys, but with all of the problems using
SendKeys, I was not sure if there was an alternative.

Thanks.

Jeff
 
J

John W. Vinson

Is it possible to have a field automatically set to edit when a form opens
(like pressing the F2 key)?

I suppose it can be done using SendKeys, but with all of the problems using
SendKeys, I was not sure if there was an alternative.

Thanks.

Jeff

You can use Setfocus in the form's Load event (not Open, it fires before the
controls are instantiated), and if you want to select the entire control or
part of it, use the SelStart and SelLen properties of the control. See the VBA
help for SelStart for an example.
 
Top