Set focus on form to nothing?

X

XP

Using Office 2003 and Windows XP;

Whenever my form loads and as users switch between tabs on a tab control:

1st choice) Set focus to nothing (i.e. no control at all), if possible.

2nd choice) if "nothing" can't be done, then the form itself? - if possible.

3rd choice) if "form" can't be done, then perhaps the current tab on the tab
control?

Can someone please post generic example code to do this?

Thanks much in advance.
 
F

fredg

Using Office 2003 and Windows XP;

Whenever my form loads and as users switch between tabs on a tab control:

1st choice) Set focus to nothing (i.e. no control at all), if possible.

2nd choice) if "nothing" can't be done, then the form itself? - if possible.

3rd choice) if "form" can't be done, then perhaps the current tab on the tab
control?

Can someone please post generic example code to do this?

Thanks much in advance.

I don't see what you expect to gain by this, but focus must go to a
control on the form.

If you don't wish it to go to a control that the user can see, add an
unbound text control to the form. Size it to a such a small size that
the user cannot see it, i.e. Width 0.001 and Height 0.001.
You'll need one on each tab.

Then code each tab's (Page1, Page2, etc.) click event:
Me.ControlName.SetFocus
 
K

Klatuu

If a form has any controls that can accept the focus, it will not take the
focus. You could just set the focus to the tab control page.

Me.MyTabeControl.Pages(n).SetFocus

Where n is the page number (Page1 is actually referred to as 0)
 
X

XP

What event would I put the code in?

Klatuu said:
If a form has any controls that can accept the focus, it will not take the
focus. You could just set the focus to the tab control page.

Me.MyTabeControl.Pages(n).SetFocus

Where n is the page number (Page1 is actually referred to as 0)
 
X

XP

FYI, actually, what I've found to work best for me is the following:

1) Create a button on the form (i.e. not a tab) with no caption and set
Transparent = True

2) In the tab control change event, Me.btnFocus.SetFocus

That way I only need one control and one function.

Thanks for your help...
 
K

Klatuu

Good plan
--
Dave Hargis, Microsoft Access MVP


XP said:
FYI, actually, what I've found to work best for me is the following:

1) Create a button on the form (i.e. not a tab) with no caption and set
Transparent = True

2) In the tab control change event, Me.btnFocus.SetFocus

That way I only need one control and one function.

Thanks for your help...
 

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