Tabbing back to a main from from a subform

  • Thread starter Thread starter Penny
  • Start date Start date
P

Penny

I have a main form with a subform within the main form. I
have my last text box with an event procedure to go to the
first text box in the subform. I want to be able to hit my
shift-Tab key and go back up to the last text box in my
main form. When I do this it goes to the last text box in
my subform. Any ideas?

Thanks in advance.


Penny
 
Hum, ok. Use the key down event of the first text box in the sub form
(since, I am SURE you want shift-tab to reverse as normal in the sub-form
UNTIL you reach the first text box in the sub form.

So, the "key down" event code for the "first" text box in the sub-form could
be:

Private Sub CustNumber_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = Asc(vbTab) And (Shift = acShiftMask) Then
KeyCode = 0
Me.Parent.Customer.SetFocus
End If

end sub

Of course, change the field name "customer" to whatever the name of the
control is on the main form that you want to move the cursor to. Also, note
the name of the sub. (just use the code builder, as it always builds the
code for you.
 
Back
Top