Tab Order : 2 Subforms

C

Charles Phillips

Hello,
I am using MS-Access 97.
I have created a form with 2 subforms (Calls and Personal)
I can tab through the main form to a subform, but when I try to tab to the
2nd subform from the 1st subform, nothing happens.
Can someone point me to some examples or samples???


Thank you,

Charles L. Phillips
 
R

ruralguy via AccessMonster.com

Have you tried holding down the Control (Ctrl) key while tabbing?
 
C

Charles Phillips

Hello,
Yes, and "Thank You".
I have tried that, but that process is not what I am trying to get.
I want the tab to flow thru the main form, to the 2 subforms, then back to
the main form.
I do not want the Users pressing ANY other key(s) than the tab key...


Thank you,

Charles L. Phillips
 
R

ruralguy via AccessMonster.com

Are the SubForms Single Forms or Continuous Forms?

Charles said:
Hello,
Yes, and "Thank You".
I have tried that, but that process is not what I am trying to get.
I want the tab to flow thru the main form, to the 2 subforms, then back to
the main form.
I do not want the Users pressing ANY other key(s) than the tab key...

Thank you,

Charles L. Phillips
Have you tried holding down the Control (Ctrl) key while tabbing?
[quoted text clipped - 15 lines]
Message posted via AccessMonster.com
 
C

Charles Phillips

Hello,
The SubForms are Single Forms...


Charles L. Phillips


ruralguy via AccessMonster.com said:
Are the SubForms Single Forms or Continuous Forms?

Charles said:
Hello,
Yes, and "Thank You".
I have tried that, but that process is not what I am trying to get.
I want the tab to flow thru the main form, to the 2 subforms, then back to
the main form.
I do not want the Users pressing ANY other key(s) than the tab key...

Thank you,

Charles L. Phillips
Have you tried holding down the Control (Ctrl) key while tabbing?
[quoted text clipped - 15 lines]
Message posted via AccessMonster.com

--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 
R

ruralguy via AccessMonster.com

Good! You can add one more TextBox to the end of the tab order on each
SubForm and name it maybe txtJump or something so it is easy to locate and
then you can set its Width and Hight to 0" so it will NOT be visible on your
form. Then put code in the OnEnter event to move the focus to the 2nd
SubForm in the case of the 1st SubForm and back to the MainForm in the case
of the 2nd SubForm. Setting focus to a SubForm is a two step process. Only
a single step needed to get back to the MainForm.
1st SubForm code:
Me.Parent.SubForm2ControlName.SetFocus
Me.Parent.SubForm2ControlName.FORM.ControlName.SetFocus

Using your control names of course!

2nd SubForm code:
Me.Parent.ControlName.SetFocus

This control name should be the 1st control in the tab order on the MainForm.




Charles said:
Hello,
The SubForms are Single Forms...

Charles L. Phillips
Are the SubForms Single Forms or Continuous Forms?
[quoted text clipped - 21 lines]
Message posted via AccessMonster.com
 
C

Charles Phillips

Hello,
"Thank You", this worked very well...


Charles L. Phillips


ruralguy via AccessMonster.com said:
Good! You can add one more TextBox to the end of the tab order on each
SubForm and name it maybe txtJump or something so it is easy to locate and
then you can set its Width and Hight to 0" so it will NOT be visible on
your
form. Then put code in the OnEnter event to move the focus to the 2nd
SubForm in the case of the 1st SubForm and back to the MainForm in the
case
of the 2nd SubForm. Setting focus to a SubForm is a two step process.
Only
a single step needed to get back to the MainForm.
1st SubForm code:
Me.Parent.SubForm2ControlName.SetFocus
Me.Parent.SubForm2ControlName.FORM.ControlName.SetFocus

Using your control names of course!

2nd SubForm code:
Me.Parent.ControlName.SetFocus

This control name should be the 1st control in the tab order on the
MainForm.




Charles said:
Hello,
The SubForms are Single Forms...

Charles L. Phillips
Are the SubForms Single Forms or Continuous Forms?
[quoted text clipped - 21 lines]
Message posted via AccessMonster.com

--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 
R

ruralguy via AccessMonster.com

Glad I could help Charles!

Charles said:
Hello,
"Thank You", this worked very well...

Charles L. Phillips
Good! You can add one more TextBox to the end of the tab order on each
SubForm and name it maybe txtJump or something so it is easy to locate and
[quoted text clipped - 28 lines]
 
G

Guest

Hi Ruralguy

I tried implementing your solution, I have the same problem as Charles, but
it didn't work. I didn't get an error message. The form/subform(s) behaved
the same way as before the code, in that after the last tab of the 1st
subform Access kept looping thru the 1st subform entries. This causes the
user to believe the entries in the first subform have been cleared. I am
using 2002 and both subforms are in single form.

Private Sub txtjump_Enter()

Me.frmPCRPrimProbesDataEntry.sfrmPCRPrimProbes.SetFocus
Me.frmPCRPrimProbesDataEntry.sfrmPCRPrimProbes.Form.txtFridgeFreezer.SetFocus

End Sub

What did I do wrong?

Thanks,
AG
 
G

Guest

My bad, poor cutting and pasting skills, my code for the first subform is:

Me.Parent.txtFridgeFreezer.SetFocus
Me.Parent.txtFridgeFreezer.Form.txtjump.SetFocus

Thanks again,
AG
 
R

ruralguy via AccessMonster.com

I'm going to guess that the OnEnter code on the first SubForm should be:

Me.Parent.sfrmPCRPrimProbes.SetFocus
Me.Parent.sfrmPCRPrimProbes.Form.txtFridgeFreezer.SetFocus
 
G

Guest

Actually, I had tried that as well, not being entirely sure if I interpreted
your advice correctly, and the same result occurred except that when I would
close and reopen the form and tab thru I would get a "Run-time error "2452"
The expression you entered has an invalid reference to the Parent property"
message.

I must remember to close forms and retry code.

1st subform : sfrmPCRPrimProbes
Last tab in 1st subform: txtjump (invisible)

2nd subform : sfrmInventory
First tab in 2nd subform : txtFridgeFreezer

Thanks,
AG
 
R

ruralguy via AccessMonster.com

It is important that the Jump control be VISIBLE or it can never receive the
focus. Just set the Width and Height to 0" and no one will see it. Try this
in the 1st SubForm txtJump control:


Private Sub txtjump_Enter()

Me.Parent.sfrmInventory.SetFocus
Me.Parent.sfrmInventory.Form.txtFridgeFreezer.SetFocus

End Sub
 
G

Guest

I put in the bit of code in the got focus event of the txtjump object and the
code worked like a charm. I then tried it in with the enter event and it as
well worked like a charm. Thanks a million rural guy. You saved me a lot of
potential reworking of forms. I'll have to share this bit of info with my
fellow Access designer in the building. Thanks for putting up with my
greeness. Some days you work on a problem so much you can't see forest for
the trees.

Thanks again,
AG
 
R

ruralguy via AccessMonster.com

You're very welcome. Glad I could help.

Access said:
I put in the bit of code in the got focus event of the txtjump object and the
code worked like a charm. I then tried it in with the enter event and it as
well worked like a charm. Thanks a million rural guy. You saved me a lot of
potential reworking of forms. I'll have to share this bit of info with my
fellow Access designer in the building. Thanks for putting up with my
greeness. Some days you work on a problem so much you can't see forest for
the trees.

Thanks again,
AG
 
G

Guest

I last question regarding this, will I encounter a problem with my second
subform returning focus to the main form b/c my second subform is used in
more than one form?

Thanks again,
AG
 
R

ruralguy via AccessMonster.com

It would be better if the SetFocus went to a specific control but I suppose
you could try just setting it to the Me.Parent and see what happens.
 
G

Guest

I did the following:

Private Sub txtmainjump_Enter()

Me.Parent.SetFocus

End Sub

But all I got was the same looping thru the entries of the subform behavior
that I am trying to get rid of.

Any ideas?

AG
 
R

ruralguy via AccessMonster.com

Maybe something will come ro me but right now nothing I tried worked to
generically move the focus back to the parent. Maybe someone else will have
some ideas. You may want to start a new thread to attract new viewers.
 

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

Similar Threads


Top