tabbing through subforms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a main form.

On this, I have a nested subform -- a subform with another subform nested in it.

I want the user to be able to tab from the mainform to the 1st (nested) subform, from that to the second subform, and then back to the main subform to enter a new record.

Using the Tab order, I can get from the main form to the nested subform. Following instructions on this site, I've entered the following:

a new unbound text box, with 0 height and 0 width and named it [invisiblebox]. In the class module, I've written:

Private Sub invisiblebox_GotFocus()
Me.Parent.firstcall.SetFocus
End Sub

(firstcall is the name of the control I want the tab to jump to)

This doesn't work. I'm clearly doing something wrong.
 
You can use SetFocus, but it requires some fiddling.

Here's a simple alternative. Create a hotkey for one of the fields on the
main form by adding an ampersand to the Caption of the Label attached to the
text box. No code needed.

For example, if the text box on the main form is called "FirstCall", you
might put this in its Caption:
&First Call
Now when you hold down the Alt key and press F, it takes you out of the
subform and straight back to this text box on the main form (unless the
subform record cannot be saved, e.g. required field missing.)


--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Sabra Briere said:
I have a main form.

On this, I have a nested subform -- a subform with another subform nested in it.

I want the user to be able to tab from the mainform to the 1st (nested)
subform, from that to the second subform, and then back to the main subform
to enter a new record.
Using the Tab order, I can get from the main form to the nested subform.
Following instructions on this site, I've entered the following:
a new unbound text box, with 0 height and 0 width and named it
[invisiblebox]. In the class module, I've written:
 
Thank you Allen!

I'll try that, although what I want is for the end user NOT to have to think about key strokes.

I *know* this user <grin>

Allen Browne said:
You can use SetFocus, but it requires some fiddling.

Here's a simple alternative. Create a hotkey for one of the fields on the
main form by adding an ampersand to the Caption of the Label attached to the
text box. No code needed.

For example, if the text box on the main form is called "FirstCall", you
might put this in its Caption:
&First Call
Now when you hold down the Alt key and press F, it takes you out of the
subform and straight back to this text box on the main form (unless the
subform record cannot be saved, e.g. required field missing.)


--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Sabra Briere said:
I have a main form.

On this, I have a nested subform -- a subform with another subform nested in it.

I want the user to be able to tab from the mainform to the 1st (nested)
subform, from that to the second subform, and then back to the main subform
to enter a new record.
Using the Tab order, I can get from the main form to the nested subform.
Following instructions on this site, I've entered the following:
a new unbound text box, with 0 height and 0 width and named it
[invisiblebox]. In the class module, I've written:
Private Sub invisiblebox_GotFocus()
Me.Parent.firstcall.SetFocus
End Sub

(firstcall is the name of the control I want the tab to jump to)

This doesn't work. I'm clearly doing something wrong.
 
Back
Top