Need to tab from subform to main form form

I have a subform "frmMaster" that I place as a subform in many different forms... I will use "frmArt" as the main form in this example.

The user first tabs through the fields on "frmMaster" then should move onto tabbing through "frmArt".  The problem is that once I hit the last field on the "frmMaster", it just cycles back to the first field of "frmMaster" instead of tabbing on to "frmArt".

I have tried the following code set to the Exit property of the last field in "frmMaster", but came up with errors each time

DoCmd.GoToControl "frmArt"
Run-time error 2109:  There is no filed named 'frmArt' in the current record.

DoCmd.GoToControl Form_Art
Run-time error 2109:  There is no filed named 'Form_frmSpecSofa' in the current record.

DoCmd.GoToControl Me.Parent
Run-time error 2498:  An expression you entered is the wrong data type for one of the arguments.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The method you want to use is .SetFocus

Choose the "next" field in frmArt, for example txtFooBar. Create an almost invisible control on frmMaster (transparent, same back color, width 0...) say txtJump, being the last in the tab order. Create the OnEnter handler:

Sub txtJump_Enter()
End Sub

This implies that all potential main forms have a "txtFooBar" control...
To be a little more fancy, make sure that the subform frmMaster is always in a subform *control* called subMaster. This way, you can use the Tag of that control to hold the name of the next control for that particular main form.

Sub txtJump_Enter()
End Sub

On the form frmArt, subMaster.Tag will be "txtFooBar", but on frmAnother, it might be "cboSelection"...

Finally, I prefer to create a txtJump control specially and use _Enter because there are many ways to exit a control, even if it is the last (shift+tab, click on another control, etc.).

Incidentally, in your attempts, you used DoCmd.Goto*Control*, but you never tried with a control name!

Hope this helps

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cdmac2Author Commented:
Wonderful!  Thank you, it took me a little while, but I figure out how to do that submaster.Tab thing that you were talking about... Works like a Charm.


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.