[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Need to tab from subform to main form form

Posted on 2004-10-26
Medium Priority
Last Modified: 2009-07-29
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.


Question by:cdmac2
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 58

Accepted Solution

harfang earned 1000 total points
ID: 12418740
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

Author Comment

ID: 12430217
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.



Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question