J
John S. Ford, MD
I have a form with an embedded subform (in datasheet view) and if the user
is in the new record field and doesn't enter data into it, I want him to be
able to jump to the next field (which is on the MAIN form and is in the next
page of a tab control) by hitting <Tab> or <Return>.
I placed the following code in the OnKeyDown event for the control (which
happens to be a ComboBox) on the subform:
Private Sub cboDiagnosis_KeyDown(KeyCode As Integer, Shift As Integer)
Dim ShiftDown As Integer, CtrlDown As Integer, AltDown As Integer
ShiftDown = (Shift And acShiftMask) > 0
CtrlDown = (Shift And acCtrlMask) > 0
AltDown = (Shift And acAltMask) > 0
If Me.NewRecord = True And Not Me.Dirty And _
Not ShiftDown And Not CtrlDown And Not AltDown And _
(KeyCode = vbKeyReturn Or KeyCode = vbKeyTab) Then
Me.Parent!txtPatientAllergies.SetFocus
End If
End Sub
txtPatientallergies is the control I want the cursor to jump to. This code
works perfectly in Access 97 but when I run this database in Access 2000 the
code somehow SKIPS the txtPatientAllergies control and jumps into the
following control (which happens to be another subform control).
Any idea why this bug doesn't happen if I run the mdb file in Access 97 but
does in Access 2000?
John
is in the new record field and doesn't enter data into it, I want him to be
able to jump to the next field (which is on the MAIN form and is in the next
page of a tab control) by hitting <Tab> or <Return>.
I placed the following code in the OnKeyDown event for the control (which
happens to be a ComboBox) on the subform:
Private Sub cboDiagnosis_KeyDown(KeyCode As Integer, Shift As Integer)
Dim ShiftDown As Integer, CtrlDown As Integer, AltDown As Integer
ShiftDown = (Shift And acShiftMask) > 0
CtrlDown = (Shift And acCtrlMask) > 0
AltDown = (Shift And acAltMask) > 0
If Me.NewRecord = True And Not Me.Dirty And _
Not ShiftDown And Not CtrlDown And Not AltDown And _
(KeyCode = vbKeyReturn Or KeyCode = vbKeyTab) Then
Me.Parent!txtPatientAllergies.SetFocus
End If
End Sub
txtPatientallergies is the control I want the cursor to jump to. This code
works perfectly in Access 97 but when I run this database in Access 2000 the
code somehow SKIPS the txtPatientAllergies control and jumps into the
following control (which happens to be another subform control).
Any idea why this bug doesn't happen if I run the mdb file in Access 97 but
does in Access 2000?
John