From: sebastico on
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
From: John W. Vinson on
On Thu, 3 Jun 2010 17:47:25 -0700, sebastico
<sebastico(a)discussions.microsoft.com> wrote:

>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)?
--

John W. Vinson [MVP]
From: sebastico on
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
"John W. Vinson" wrote:

> On Thu, 3 Jun 2010 17:47:25 -0700, sebastico
> <sebastico(a)discussions.microsoft.com> wrote:
>
> >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)?
> --
>
> John W. Vinson [MVP]
> .
>
From: John W. Vinson on
On Thu, 3 Jun 2010 22:24:38 -0700, sebastico
<sebastico(a)discussions.microsoft.com> wrote:

>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.
--

John W. Vinson [MVP]
From: sebastico on

John.
Thank very much. That is what I need. I was trying with vba.
"John W. Vinson" wrote:

> On Thu, 3 Jun 2010 22:24:38 -0700, sebastico
> <sebastico(a)discussions.microsoft.com> wrote:
>
> >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.
> --
>
> John W. Vinson [MVP]
> .
>