Tab Order 2 Subforms

  • Thread starter Charles L. Phillips
  • Start date
C

Charles L. Phillips

Hello,
I am using MS-Access 2003.
I have 1 mainform and 2 subforms, on the mainform.
I can tab perfectly from the mainform to the 1st subform, but cannot
continue to tab through the 2nd subform, then back to the mainform...

I need to tab through the mainform, both subforms, then back to the
mainform.
I have tried several searches for this process, but have had no success or
I'm overlooking the answer.
Can/will someone direct me to some examples or samples???


Thank you,


Charles L. Phillips
 
G

Graham Mandeno

Hi Charles

Unfortunately there is no automatic way to tab OUT of a subform. You can
tab into it because the subform control is part of the tab order of the main
form, but once you are there you are trapped by the subform's tab order and
can't escape without intervention by user or code.

A good workaround is to add to your subform an invisible control that can
get the focus - a small transparent command button is ideal. Place this
control last in the tab order on your subform and write some code for its
GotFocus event:

With Me.Parent![Subform2]
.SetFocus
.Form![FirstControl].SetFocus
End With

....where "Subform2" is the name of the subform control containing the second
subform and "FirstControl" is the name of the control on the second subform
that you want to tab to.
 
J

John W. Vinson

Hello,
I am using MS-Access 2003.
I have 1 mainform and 2 subforms, on the mainform.
I can tab perfectly from the mainform to the 1st subform, but cannot
continue to tab through the 2nd subform, then back to the mainform...

I need to tab through the mainform, both subforms, then back to the
mainform.
I have tried several searches for this process, but have had no success or
I'm overlooking the answer.
Can/will someone direct me to some examples or samples???

Each subform has its own independent tab order. Typically a subform is used to
enter an arbitrary number of records in the child table, so if you take the
defaults, tabbing out of the last field in the subform's tab order will put
you into a new record on the same subform.

If you want to override this behavior, and (as a side effect) make it more
difficult for the user to add two subform records, you can put an unbound
textbox last in the first subform's tab order. Call it txtRelay, and probably
hide it behind some other control so the user can't mouseclick into it. In its
Got Focus event put:

Private Sub txtRelay_GotFocus()
Parent!SecondSubform.SetFocus
Parent!SecondSubform.Form!controlname.SetFocus
End Sub

to set the focus first to the other subform, and then to the desired first
control in the second subform's tab order. Do something similar on the second
subform.


John W. Vinson [MVP]
 
C

Charles L. Phillips

Hello,
"Thank You" for your timely response, but would it be more simple to make
this process 1 mainform, or combine the mainform and the 1st subform...


Thank you,

Charles L. Phillips


Graham Mandeno said:
Hi Charles

Unfortunately there is no automatic way to tab OUT of a subform. You can
tab into it because the subform control is part of the tab order of the
main form, but once you are there you are trapped by the subform's tab
order and can't escape without intervention by user or code.

A good workaround is to add to your subform an invisible control that can
get the focus - a small transparent command button is ideal. Place this
control last in the tab order on your subform and write some code for its
GotFocus event:

With Me.Parent![Subform2]
.SetFocus
.Form![FirstControl].SetFocus
End With

...where "Subform2" is the name of the subform control containing the
second subform and "FirstControl" is the name of the control on the second
subform that you want to tab to.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

Charles L. Phillips said:
Hello,
I am using MS-Access 2003.
I have 1 mainform and 2 subforms, on the mainform.
I can tab perfectly from the mainform to the 1st subform, but cannot
continue to tab through the 2nd subform, then back to the mainform...

I need to tab through the mainform, both subforms, then back to the
mainform.
I have tried several searches for this process, but have had no success
or I'm overlooking the answer.
Can/will someone direct me to some examples or samples???


Thank you,


Charles L. Phillips
 
C

Charles L. Phillips

Hello,
Yes, I do want to make this form (process) easy for the User(s), so do you
think making 1 mainform would be best...


Thank you,

Charles L. Phillips
 
J

John W. Vinson

Hello,
Yes, I do want to make this form (process) easy for the User(s), so do you
think making 1 mainform would be best...

Since I have no idea how your tables are structured, how the data in them is
logically related, how skilled your users might be, all I can say is I don't
have any idea.

John W. Vinson [MVP]
 
G

Graham Mandeno

Hi Charles

That's very difficult to say. Subforms are usually used to contain data
which is related in some way to the recordsource of the main form. This
might be a one-to-many relationship, in which case you could not use a
single main form. One form will always be a "simpler" option, but it might
not be practical!

If you were to post some more details about your table structures and a
description of your form design, we might be able to help further.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

Charles L. Phillips said:
Hello,
"Thank You" for your timely response, but would it be more simple to make
this process 1 mainform, or combine the mainform and the 1st subform...


Thank you,

Charles L. Phillips


Graham Mandeno said:
Hi Charles

Unfortunately there is no automatic way to tab OUT of a subform. You can
tab into it because the subform control is part of the tab order of the
main form, but once you are there you are trapped by the subform's tab
order and can't escape without intervention by user or code.

A good workaround is to add to your subform an invisible control that can
get the focus - a small transparent command button is ideal. Place this
control last in the tab order on your subform and write some code for its
GotFocus event:

With Me.Parent![Subform2]
.SetFocus
.Form![FirstControl].SetFocus
End With

...where "Subform2" is the name of the subform control containing the
second subform and "FirstControl" is the name of the control on the
second subform that you want to tab to.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

Charles L. Phillips said:
Hello,
I am using MS-Access 2003.
I have 1 mainform and 2 subforms, on the mainform.
I can tab perfectly from the mainform to the 1st subform, but cannot
continue to tab through the 2nd subform, then back to the mainform...

I need to tab through the mainform, both subforms, then back to the
mainform.
I have tried several searches for this process, but have had no success
or I'm overlooking the answer.
Can/will someone direct me to some examples or samples???


Thank you,


Charles L. Phillips
 
C

Charles L. Phillips

Hello,
Sorry for the delay, but I've decided to make 1 form.
Your input has been very insightful...


Thank you,

Charles L. Phillips
 

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