Unanswered: If Statement That Would Allow Navigation between fields of two Subforms in A Nav
Once again I am reaching out to the Access Experts. I have a Navigation Form Named ClientRecord and within that navigation for I have two subforms; ClientData and VeteranInfo. My dilemma arises when I try to jump to another field on other subform. I would appreaciate if someone would show me how I would correctly create a macro or VBA to accomplish this. In my particular situation in the first Subform ClientData I have a field named Veteran if I select yes(1) from combo box I want it to than send me directly to VeteranInfo Subform first field named MilitaryBranch. Thanks Everyone for all your help and have a great day
The secret to setting focus to field on second subform from first subform is...
I have created an example database with the 3 forms specified to demonstrate.
It is an access 2010 database file (no tables, just 3 mockup forms)
You have to set focus to the second subform first before you can set focus to a control on it.
So, on your subform ClientData, add an event handler to your Veteran field After_Update event and do the following:
Private Sub Veteran_AfterUpdate()
If Me.Veteran.Value = 1 Then
' Field2 below is the name of the next field on the ClientData form to move to
' as an example if you select other than yes (1). Replace it with the real name
' of your next field on the ClientData form
In my example above, both the subforms themselves and the subform container controls on the parent form ClientRecord share the same names. Thus, in the code above, VeteranInfo is the name of the subform container control on the ClientRecord form, not the subform itself.