Tab Stop between Form and Subform

T

Tom Ventouris

I have a form with two subforms. The Tab Stop Index moves through all
controls on the main form before it goes to asubform. I want to be able to
move back and forth between the forms.

My first thought is to use SetFocus, but I have a lot of fields and this
will probably need to be activated by the Tab Key and/or the Enter Key. Is
there another way?
 
A

Allen Browne

The simplest solution will be to use hotkeys.

Say subform1 has a text box named City. Change the Caption property of the
label attached to this text box so it reads:
&City

You can now use Alt+C to jump to that text box.

If you want to take the SetFocus approach instead, there's 2 steps: make the
subform control the active control of the main form, and then make the
specific text box you desire to be the active control in the subform itself:
Me.[Sub1].SetFocus
Me.[Sub1].Form![Text0].SetFocus
Before focus moves into the subform, it's a good idea to save the existing
main form record first, so I suggest adding this line above those two:
If Me.Dirty Then Me.Dirty = False
 
T

Tom Ventouris

Thank you. I will be using the Setfocus in the EnterKey to eliminate the need
for additional keys, such as Ctr+C, since this approach will require
additional actions by the uses - look for the next label and press the keys.

Allen Browne said:
The simplest solution will be to use hotkeys.

Say subform1 has a text box named City. Change the Caption property of the
label attached to this text box so it reads:
&City

You can now use Alt+C to jump to that text box.

If you want to take the SetFocus approach instead, there's 2 steps: make the
subform control the active control of the main form, and then make the
specific text box you desire to be the active control in the subform itself:
Me.[Sub1].SetFocus
Me.[Sub1].Form![Text0].SetFocus
Before focus moves into the subform, it's a good idea to save the existing
main form record first, so I suggest adding this line above those two:
If Me.Dirty Then Me.Dirty = False

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Tom Ventouris said:
I have a form with two subforms. The Tab Stop Index moves through all
controls on the main form before it goes to asubform. I want to be able to
move back and forth between the forms.

My first thought is to use SetFocus, but I have a lot of fields and this
will probably need to be activated by the Tab Key and/or the Enter Key. Is
there another way?
 

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