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.
 

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