Set Focus on a object in a form

  • Follow


How do I set the focus to a particular object in a form? And can I use a 
Control Button to allow this in my form? For example I wanted to allow 
someone to add a new record to my form using a control Button labeled 'Add 
Entry'. I created a control button to do this with a macro on my form; but I 
cannot get the focus to return to a specific object. I was able to do 
something like this in Visual Basic 5.0 but I am not sure how (if possible) 
using Access 2003. 
0
Reply Utf 2/12/2008 6:34:01 PM

You could use the Tab Order of the form and set the control you want to have 
the focus to a tab order of 0.  If that will not work for you, you can put a 
line in the Load event of the form to set the focus:

    Me.MyControl.Setfocus
-- 
Dave Hargis, Microsoft Access MVP


"myseven123" wrote:

> How do I set the focus to a particular object in a form? And can I use a 
> Control Button to allow this in my form? For example I wanted to allow 
> someone to add a new record to my form using a control Button labeled 'Add 
> Entry'. I created a control button to do this with a macro on my form; but I 
> cannot get the focus to return to a specific object. I was able to do 
> something like this in Visual Basic 5.0 but I am not sure how (if possible) 
> using Access 2003. 
0
Reply Utf 2/12/2008 6:57:03 PM


YourObjectName.SetFocus

myseven123 wrote:
>How do I set the focus to a particular object in a form? And can I use a 
>Control Button to allow this in my form? For example I wanted to allow 
>someone to add a new record to my form using a control Button labeled 'Add 
>Entry'. I created a control button to do this with a macro on my form; but I 
>cannot get the focus to return to a specific object. I was able to do 
>something like this in Visual Basic 5.0 but I am not sure how (if possible) 
>using Access 2003.

-- 
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200802/1

0
Reply Linq 2/12/2008 6:58:50 PM

How do I do that?

"Klatuu" wrote:

> You could use the Tab Order of the form and set the control you want to have 
> the focus to a tab order of 0.  If that will not work for you, you can put a 
> line in the Load event of the form to set the focus:
> 
>     Me.MyControl.Setfocus
> -- 
> Dave Hargis, Microsoft Access MVP
> 
> 
> "myseven123" wrote:
> 
> > How do I set the focus to a particular object in a form? And can I use a 
> > Control Button to allow this in my form? For example I wanted to allow 
> > someone to add a new record to my form using a control Button labeled 'Add 
> > Entry'. I created a control button to do this with a macro on my form; but I 
> > cannot get the focus to return to a specific object. I was able to do 
> > something like this in Visual Basic 5.0 but I am not sure how (if possible) 
> > using Access 2003. 
0
Reply Utf 2/18/2008 5:33:01 PM

3 Replies
818 Views

(page loaded in 0.002 seconds)


Reply: