Jump out of subform

  • Thread starter Thread starter chriske911
  • Start date Start date
C

chriske911

how can I jump out of a subform upon reaching the last (sub)record?

the subform is in continuous view
how can I jump back to the parent form if I have tabbed to the last
control of the last record or when I enter a new subrecord?

thnx
 
chriske911 said:
how can I jump out of a subform upon reaching the last (sub)record?

the subform is in continuous view
how can I jump back to the parent form if I have tabbed to the last
control of the last record or when I enter a new subrecord?

What constitutes the "last" subrecord? If you want to allow new records to
be entered at all, then tabbing through the fields in each record will
eventually put you into the first field of the next record, and then (after
all existing records) into the first field of the new (empty) record. How can
Access tell whether you want to enter a new record or not?

That said... you can put an unbound textbox last in the tab order. In its
GotFocus event you can put code like

Me.Parent.SetFocus
Me.Parent.controlname.SetFocus

to jump to a selected control in the parent form. It sounds like you only
want to do so selectively, so you'll need to decide under what conditions you
want to jump out, and under what other conditions you don't!
 
chriske911 said:
What constitutes the "last" subrecord? If you want to allow new records to
be entered at all, then tabbing through the fields in each record will
eventually put you into the first field of the next record, and then (after
all existing records) into the first field of the new (empty) record. How can
Access tell whether you want to enter a new record or not?

That said... you can put an unbound textbox last in the tab order. In its
GotFocus event you can put code like

Me.Parent.SetFocus
Me.Parent.controlname.SetFocus

to jump to a selected control in the parent form. It sounds like you only
want to do so selectively, so you'll need to decide under what conditions you
want to jump out, and under what other conditions you don't!

it actually doesn't matter to me if I can jump out on the first or last
bound control of an existing subrecord or from the "new" subrecord

it's only that I want the user to stay in tabbing inside the current
displayed page
for now I do jump from the parent's last control into the first control
of the top record in the subform (continuous view)
but I don't know of a way to get out of it and return to the parent
form

setting focus is not necessary cause of the tab order
when I enter the parent form the focus will automagically be set to the
control with the lowest tab index, right?

I was thinking of using the current event and stating something like on
entering a new record jump to the parent form
but off course this would prohibit the adding of any new record

so it has to be something that will jump if it is entered by tabbing
but not when reached by mouse click

or maybe....
would it be handy if I were to provide a keyboard shortcut for this?
something like on keypress alt + R (from Return, you see ;-)
and jump in and out respectively

thnx
 
Ctrl-tab jumps to parent form. I just put text stating "When done
entering data, Ctrl tab to return to main table" Or set a control tab
to return to main form
 
Ctrl-tab jumps to parent form. I just put text stating "When done
entering data, Ctrl tab to return to main table" Or set a control tab
to return to main form

thnx a million
didn't need more than that

grtz
 
Back
Top