Open Form

davey3389

Registered User.
Local time
Today, 21:02
Joined
Jul 16, 2012
Messages
30
Can anyone tell me if there is a code i can enter than when i press F9 on the keyboard it opens a form
 
You can use the KeyDown event to detect a key press, some code in that event along the lines of;
Code:
If KeyCode = 120 Then
     DoCmd.[URL="http://msdn.microsoft.com/en-us/library/office/aa220276%28v=office.11%29.aspx"]OpenForm[/URL] "YourFormName"
End If
 
Thanks can you explain why F9 is key code 120
 
If you want to find out the value of a key use;
Code:
MsgBox KeyCode
In the Key Down event.
 
Where do i enter the code so it works from any part of the database
 
The Key Down event is specific to forms. So you will need at least one form open for this code to work.
 
In the Key Down event of a form, as John said in his earlier post. If the form has any controls, I think you will need to set the forms Key Preview property to Yes.

Sorry John, I got distracted and missed your last post.
 
No problem bob, you've added a little move info that I had not thought to mention :)
 
You'd need;
Code:
If KeyCode = 120 Then
     DoCmd.RunMacro "YourMacroName"
End If
 

Users who are viewing this thread

Back
Top Bottom