Subform Lost Focus Next Record Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sblakethomas
    New Member
    • May 2010
    • 3

    Subform Lost Focus Next Record Error

    I created a code that would take me from the last field in a subform and take me to the next record first field on the parent form. Unfortunately, there is a little snag if I try to use the mouse to click into the subform from the parent form. It takes me to the next record again instead of just allowing me to click into the subform for that record. If I just tab, everything is fine, but this db is being used by others that may not remember or understand to use the tab function. Is there a way to fix this code?

    Thanks in advance!

    Code:
    Private Sub Remove_Account_From_LostFocus()
       Me.Parent![SAP Postal Code].SetFocus
      DoCmd.GoToRecord , , acNext
    End Sub
  • Jim Doherty
    Recognized Expert Contributor
    • Aug 2007
    • 897

    #2
    Originally posted by sblakethomas
    I created a code that would take me from the last field in a subform and take me to the next record first field on the parent form. Unfortunately, there is a little snag if I try to use the mouse to click into the subform from the parent form. It takes me to the next record again instead of just allowing me to click into the subform for that record. If I just tab, everything is fine, but this db is being used by others that may not remember or understand to use the tab function. Is there a way to fix this code?

    Thanks in advance!

    Code:
    Private Sub Remove_Account_From_LostFocus()
       Me.Parent![SAP Postal Code].SetFocus
      DoCmd.GoToRecord , , acNext
    End Sub
    You need to check your subform tab orders and sequence things so that some 'other' control gets the focus 'before' you leave the subform so that when you click back into the subform (which gets first focus) focus is then then passed to the first control in the tab order

    Code:
    Me!The_First_Control_In_Your_Tab_Sequence_Name.Setfocus
    Me.Parent![SAP Postal Code].SetFocus 
     DoCmd.GoToRecord , , acNe
    xt

    Comment

    Working...