Parent/Subform tabbing issues

R

Rob S

I'm somewhat new to db programming though our IT guy seems to think I've
created a pretty good db. I am having one major issue that I cannot seem to
figure out. I've searched the web and newsgroups and haven't been able to
find an answer that totally solves my problem and hope someone can suggest a
solution. My db includes the following tables/forms

Top (which is my parent form)
Contact Info
Counties
Service

What I'd like to do is tab from the last control on Top into the first
control on Contact Info and then from the last box on Contact info into the
the Counties, etc. I've been able to move from Contact Info into counties
by associating the following code with the last text box on Contact Info:

Private Sub Notes_Click()
Me.Parent.TabCtl12.Pages("Counties").SetFocus
End Sub

I have two problems though. Counties into Service is a bit more comlicated
as both of these forms are set up as datasheet forms, obtaining their info
from respective tables through a lookup and allowing information to be
entered in dropdown boxes. Is there a way to attach a similar statement to
the last box of a datasheet form so that if you tab out without entering any
data it will move to the next subform?

Thanks in advance for any suggestions.

Robert
 
P

Pieter Wijnen

You must trap the keyCode in the last field of the subForm

Private Sub Text0_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 9 And Shift = 0 Then ' Tab key
KeyCode = 0
Me.Parent.SubForm2.Form.MyControl.SetFocus
End If
End Sub

HtH

Pieter
 
Top