Set focus

S

sebastico

Hello Forum

Access 2003
I'm trying to set focus in txtStart,

Private Sub txtStart_GotFocus()
Me.txtStart.SetFocus
End Sub

but when form is open Focus is in another txtbox
How do I set focus in a txtStart?

Many thanks
 
J

John W. Vinson

Hello Forum

Access 2003
I'm trying to set focus in txtStart,

Private Sub txtStart_GotFocus()
Me.txtStart.SetFocus
End Sub

but when form is open Focus is in another txtbox
How do I set focus in a txtStart?

Many thanks

This code makes no sense: it's like saying "When you get to Times Square, go
to Times Square". The GotFocus event of txtStart will fire only when the user
sets the focus to that control...

What are you trying to accomplish? At what point do you want to set the focus?
Can you not simply set txtStart to be the first control in the form's tab
order? Or do you want to set the focus to the control in the Form's Current
event (which fires when you move to a different record)?
 
S

sebastico

John
I made a few attempts at this, but so far no luck.I think I still don't get
the sense of vba syntax.

I want the txtStart to be the first control in the form's tab order. Any
time I open the form focus must be in that control.

Many thanks again
 
J

John W. Vinson

I want the txtStart to be the first control in the form's tab order. Any
time I open the form focus must be in that control.

Open the form in design view.
Select the txtStart control.
View its Properties.
Find the "Tab Order" property.
Set it to 0.

Alternatively, rightclick the little square at the upper left intersection of
the rulers and choose Tab Order. You can move controls up and down in the
list; when you save the form it will reset the order.

No VBA should be needed to do this.
 

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