Incorrect cursor position

  • Thread starter Thread starter Valerie
  • Start date Start date
V

Valerie

I have a form with a subform in a database made from an
Access template. I have set my tab order like I want it
in both the form and the subform. When I reach the last
field in the form and hit tab, it automatically goes to
the first field in the subform. However, after filling in
all the info on the subform, when I go on to the next
record and reach the last field in the form and hit tab,
it goes to the last field in the subform (where I last
left it). How can I fix this?
 
Fix it to do what? Go back to the main form? Go to the next record in the
subform?
 
I want it to go to the first field in the subform. As it
stands, if I were inputting new data, once I got to the
last field of the 2nd record, it would take me to the
last field of the subform rather than the first field of
the subform. It works right on the first record, but
(presumably) because the last field I dealt with in the
subform before returning to it was the LAST field, that's
where it wants to return to.
 
One way (may not always be what you want) is to use the OnEnter event of the
subform control (the main form's control that actually is holding the
subform object) to set the Focus onto the first field:

Private Sub SubformControlName_Enter()
Me.SubformControlName.Form.NameOfFirstField.SetFocus
End Sub
 
Back
Top