Form navigations question...

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

Guest

I would like to set a tab order that cycles through the form header fields
and on exiting the last field goto an field on a subform.

I attempted to create a macro using the goto commnad. When the macro
executes an error states the form must be open to goto the record. If I
precede the goto statement with an "open" then the subform opens in a new
window. I would like to avoid another window and just goto the subform in
the detail of the main form.

Is there a macro I should be using or will a small piece of code serve me
better?
 
First, there is no need for code, by setting the fields TAB order it will
behave just as you want.
Set the subform as the next Tab number after the last field in the header,
and the cursor will jump there automatically.

Another way to set the focus from a field in the main form to a field in the
subfrom.
On the On Exit event of the field in the form header you can set the focus
to any other field

To a field in the form
Me.FieldName.SetFocus

To a field in the sub form
Me.[Sub form control name].form.[FieldName].SetFocus
 
I believe the tab numbering for the header section is separate from the tab
numbering for the detail section. Please let me know if there is a trick to
link the header tabs to the detail tabs.

I did try the piece of code you suggested, but am not seeing the cursor move
to the right field in the detail section. Is there another piece to go along
with the command you had suggested? I do not get an error when running it,
but the cursor does not move to the detail, it simply goes back to the first
field set in the tab order.

Thanks again for your help.

Ofer said:
First, there is no need for code, by setting the fields TAB order it will
behave just as you want.
Set the subform as the next Tab number after the last field in the header,
and the cursor will jump there automatically.

Another way to set the focus from a field in the main form to a field in the
subfrom.
On the On Exit event of the field in the form header you can set the focus
to any other field

To a field in the form
Me.FieldName.SetFocus

To a field in the sub form
Me.[Sub form control name].form.[FieldName].SetFocus

--
Please respond to the group if your question been answered or not, so other
can refer to it.
Thank you and Good luck



Tim said:
I would like to set a tab order that cycles through the form header fields
and on exiting the last field goto an field on a subform.

I attempted to create a macro using the goto commnad. When the macro
executes an error states the form must be open to goto the record. If I
precede the goto statement with an "open" then the subform opens in a new
window. I would like to avoid another window and just goto the subform in
the detail of the main form.

Is there a macro I should be using or will a small piece of code serve me
better?
 
To answer your first question, you right, the fields in the subform are
seperate then the fields in the header of the form.
You need to set the Tab order for each form seperatly, and then in the main
form you can set the tab order to the sub form control name.

Second question
Try setting the focus first to the sub form, and then to the field in the
subform

Me.[SubFormName].SetFocus
Me.[SubFormName].Form.FieldName.SetFocus

--
Please respond to the group if your question been answered or not, so other
can refer to it.
Thank you and Good luck



Tim said:
I believe the tab numbering for the header section is separate from the tab
numbering for the detail section. Please let me know if there is a trick to
link the header tabs to the detail tabs.

I did try the piece of code you suggested, but am not seeing the cursor move
to the right field in the detail section. Is there another piece to go along
with the command you had suggested? I do not get an error when running it,
but the cursor does not move to the detail, it simply goes back to the first
field set in the tab order.

Thanks again for your help.

Ofer said:
First, there is no need for code, by setting the fields TAB order it will
behave just as you want.
Set the subform as the next Tab number after the last field in the header,
and the cursor will jump there automatically.

Another way to set the focus from a field in the main form to a field in the
subfrom.
On the On Exit event of the field in the form header you can set the focus
to any other field

To a field in the form
Me.FieldName.SetFocus

To a field in the sub form
Me.[Sub form control name].form.[FieldName].SetFocus

--
Please respond to the group if your question been answered or not, so other
can refer to it.
Thank you and Good luck



Tim said:
I would like to set a tab order that cycles through the form header fields
and on exiting the last field goto an field on a subform.

I attempted to create a macro using the goto commnad. When the macro
executes an error states the form must be open to goto the record. If I
precede the goto statement with an "open" then the subform opens in a new
window. I would like to avoid another window and just goto the subform in
the detail of the main form.

Is there a macro I should be using or will a small piece of code serve me
better?
 
Back
Top