Is It Possible to Tab out of a Subform?

  • Thread starter skyrise via AccessMonster.com
  • Start date
S

skyrise via AccessMonster.com

Does anyone know if there is a way to tab out of a subform, especially when
it is in datasheet view?

Thanks for your help.
 
D

Douglas J. Steele

You could add a small control to the form being used as a subform, and have
the GotFocus event of that control set focus back to the parent form.
 
K

Ken Snell MVP

You can use Ctrl+TAB to "tab" from a subform to the main form.

You also can use a control's event procedure to do it for you. There are a
couple of ways you can do this:

(1) Use the OnExit event of the "last" control (the one that will have the
focus last, when you want to go to the main form) on the subform to set
focus to a specific control on the mainform:

Private Sub ControlNameOnSubform_Exit(Cancel As Integer)
Me.Parent.ControlNameOnMainForm.SetFocus
End Sub



(2) Use an almost invisible textbox as the last control in the subform's tab
sequence (textbox has height of zero and width of zero), and use that
textbox's GotFocus event to set focus to control on main form:

Private Sub TinyControlNameOnSubform_GotFocus()
Me.Parent.ControlNameOnMainForm.SetFocus
End Sub
 
S

skyrise via AccessMonster.com

(TY: Ken Snell MVP) for reminding me of the Ctrl + Tab function.

Because I am trying to set up a quick and easy database, I have placed a
label control on the form to tell users to Press (Ctrl + Tab) to exit the
subform.

It works great for my needs in relation to Tab Order. Exiting the subform
places the cursor in the next field on the Main Form that is expected based
on the Tab Order.

If the next field is another subform, then the cursor enters into the subform
on the field that has the SetFocus.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top