Results 1 to 2 of 2
  1. #1
    Join Date
    May 2014

    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

  2. #2
    Join Date
    Mar 2015

    Thumbs up 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
    End If
    End Sub

    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.
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts