Cursor moving on multi Subforms in a form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sandhya1988
    New Member
    • Oct 2014
    • 30

    Cursor moving on multi Subforms in a form

    Issue with Cursor moving on multi Subforms in a form

    I have two Subforms in a main form as per screenshot. So Cursor moving from Main form to 1st Subform working is good. After can’t move the cursor from 1st subform to 2nd subform with tabbing or entering and still there in 1st Subform in the last entered filed. I’ve checked on tab orders they are shown correct and checked the subform Property Cycle & tried also (All Records, Current Record & Current Page) but there is no change move to 2nd subrom. Can you please replay how to solve this problem? Is there any VBA code requires?

    Thanks,
    Sandhya.
    Attached Files
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3653

    #2
    I assume your Main form has controls in correct tab order with the First SubForm before the second SubForm?

    Thus, when you enter a SubForm, it does not matter what the Tab order is on the Main form, as you are no longer on that Form. You cannot (as far as I know) navigate using the tab key from one subform to the next subform (nor back to the main form. You can only begin on the main form and navigate tot eh subform.

    Perhaps you could add a procedure in the first subform, in the AfterUpdate Event of the last control you are in sets the focus onto the SubForm (or even a specific control on the second SubForm.

    This would be about the only way I know around this issue. However, it would require you to update that last control. As long this is the case it would work.

    Hope this hepps.

    Comment

    • Brilstern
      New Member
      • Dec 2011
      • 208

      #3
      Just thinking out loud here.

      You could make a what I like to call invisible control, it is just a txt box that is set to ="." and made super small, and set it to the last tab order. Set the On Focus event to change your focus to your 2nd Subform.

      Could this work TF?

      It may be crude but efficient nonetheless.

      Comment

      • twinnyfo
        Recognized Expert Moderator Specialist
        • Nov 2011
        • 3653

        #4
        Stevan,

        It certainly would work. It is the same concept I described. There will be problems with either, as what happens if a user needs to update several of the "key" text boxes or "tabs" through a series of records on the first subform.

        There are advantages and challenges to each recommended solution. There may also be some unexpected results for the user who doesn't understand what is going on....

        Comment

        • Brilstern
          New Member
          • Dec 2011
          • 208

          #5
          Very true! Tab controls can be so tricky when considering the user of the database.

          Comment

          • Sandhya1988
            New Member
            • Oct 2014
            • 30

            #6
            Cursor moving on multi Subforms in a form

            Thanks for replay twinnyfo & Stevan,

            Yes, Just I was checked again the main form tab order it’s shown correct. And I need to begin on the main form to Subform1 & 2 and finally come to main form. Once Attached the Main & Subform’s Tab Order screenshots… if any wrong in Tab order.

            I’ve tried following VBA code in the first subform, in the AfterUpdate Event of the last control. But there is no workout. Can you please replay how to give a VBA code?

            Code:
            Private Sub Amount_AfterUpdate()
            Form![SB_1]![SB_1Subform_Rec].SetFocus
            End Sub
            
            Form Names:
            Main form: PB_1
            Subform 1: PB_1Subform
            Subform 2: PB_1Subform_Rec
            And a little bit confusion about set to ="." how to use this :(

            Thanks,
            Sandhya.
            Attached Files
            Last edited by Rabbit; Mar 6 '15, 08:57 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.

            Comment

            • twinnyfo
              Recognized Expert Moderator Specialist
              • Nov 2011
              • 3653

              #7
              Try this:

              Code:
              Private Sub Amount_AfterUpdate()
                  Me.Parent.Form.PB_1Subform_Rec.Form.ControlName.SetFocus
              End Sub
              Also, please use code tags around your code.

              Comment

              • Sandhya1988
                New Member
                • Oct 2014
                • 30

                #8
                Thanks for suggestion... i will try this

                Comment

                Working...