Tab order to sub-form...

sroughley

New member
Local time
Today, 09:07
Joined
Jan 22, 2003
Messages
5
Hey all, I am trying to find a way to tab from a field on a Parent form to a field on its child form. I am trying to do something like:

PHP:
Private Sub FormField1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyTab Then
        Me.frmSubForm.Form!FormField2.SetFocus
    End If
End Sub

But can't get it to work.

Any ideas?

Regards.

Steve.
 
Last edited:
So you mean the last field on the parent should be, for example, 15 and the first on the sub form would then be 16?

Regards.

Steve.
 
Cheers for the help, but I can't seem to get it to work. All that is happening is the Tabing is cycling through the fields on the parent form and not moving on to the child form. I have set the tab order to go from the parent to the child form, but it just doesn't seem to be doing anything.

Any ideas?

Regards.

Steve.
 
OK, I've searched the web quite thouroughly now, and have found in several places that I need to use the setfocus method on the key down event like so:

PHP:
Private Sub Email_KeyDown(KeyCode As Integer, Shift As Integer)
    Dim mblnTabPressed As Boolean
    mblnTabPressed = (KeyCode = vbKeyTab)
    If mblnTabPressed Then
        Me!frmReqLines.SetFocus
        Me!frmReqLines!PartNo.SetFocus
    End If
End Sub

But this throws the error 'Can't move focus to the control frmReqLines!'.

I'm just getting confused now.

Steve.
 

Users who are viewing this thread

Back
Top Bottom