View Full Version : Setting the focus


Robert C
04-14-2000, 04:38 AM
How can I ensure that a particular field on a form has the focus when the form is opened?

Thank you.

Peter Paul
04-14-2000, 05:41 AM
Set the tab number for that field to zero.

Hope it helps,
Peter Paul

R. Hicks
04-14-2000, 01:27 PM
What Peter suggests will not work if you have the Tab Stop of the control set to No. What you need to do is use the On Open event of your form:

Private Sub Form_Open(Cancel As Integer)
YourControlName.SetFocus
End Sub

Change YourControlName to the name of the control you wish to receive the focus.

HTH
RDH

[This message has been edited by R. Hicks (edited 04-14-2000).]

[This message has been edited by R. Hicks (edited 04-14-2000).]