Form to Subform navigation

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

Guest

On my main form I have a subform containing only one field (a memo field for
addresses). Not all main form records have a subform record. The subform
records are displayed from a different but related table. This subform is
not included in the tab order of the main form and I do not want this. I
need a keyboard option to enter the subform field if necessary (to amend, or
copy address).

I know I can Alt+Tab from within the subform field to leave it and return to
my chosen field on the main form, but how can I set up a keyboard combination
which will drop me into the subform field to begin with from wherever I
happen to be on the main form? The normal " &Fieldname " routine does not
work.

Thanking you in advance for your assistance
 
I just gave it a try. If you have a label this is ATTACHED to the subform
control, you can use the & in the label to create an Alt+Key option that
will take you to the subform. This will place you in the subform at the item
that has the highest priority in the tab order or the last item that had the
focus if you've been their previously while the form has been open. Once
you're in the subform, you could have another Alt+Key option to take you to
the desired field. However, since you only have one field in this case, that
shouldn't be needed.
 
Set the form property 'Key preview' of your main form to Yes
Create an event procedure behind the On Key Up event of the form.

If KeyCode = 68 And Shift = 6 Then
me.SubFormName.Form.ControlName.SetFocus
end if

in this example 68 and 6 are what is trapped if I press CTRL+ALT P

Put a message box in yours to find the values of Keycode and Shift for the
key or keys you want to use.
 
Thank you Dennis, You have helped me to resolve the problem. All is working
properly now.
 
Thank you Wayne. You have helped me to resolve the problem. All is working
properly now.
 
Back
Top