And this is what I use for the F12 key to hide the current form and open a new form
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyF12
KeyCode = 0
If lstEmp > -1 Then 'lstEmp is a list box
DoCmd.OpenForm "employee details", , , "end_pk = " & lstEmp.Column(1)
Forms!startup.Visible = False
Else
MsgBox "Please select an employee"
End If
End Select
End Sub
Note that both trevor40 and I use the "Form_KeyDown" event, NOT the "Form_Open" event.
Could also use the "Form_KeyUp" event.