UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Assign A Short Cut Key To A Form, Access 2013    
 
   
fogline
post Nov 20 2018, 09:30 AM
Post#1



Posts: 69
Joined: 5-August 15
From: Ringgold, GA. USA


I need to Assign a Short Cut Key to a Form
I have one form that I need if the user uses the shortcut Ctrl+L
it will run a AutoKey that I do have setup and that AutoKey Ctrl+L will run some code.
But I don't know how to assign it to just that one form.
I have some text boxes on the form so I cant put it in the Key Down event Like I have seen.
I would maybe just have it in the OnCurrent and put an IF statement in it.
Like: IF User clicks Ctrl+L then run Macro

Thanks for any help.
Ray
This post has been edited by fogline: Nov 20 2018, 09:31 AM
Go to the top of the page
 
GroverParkGeorge
post Nov 20 2018, 09:59 AM
Post#2


UA Admin
Posts: 35,325
Joined: 20-June 02
From: Newcastle, WA


Where and when would you want your users to use this short cut key?

--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
fogline
post Nov 20 2018, 10:06 AM
Post#3



Posts: 69
Joined: 5-August 15
From: Ringgold, GA. USA


Just on this one form.
If the user clicks Ctrl+L anytime anywhere when that one form is open.
I can change to Shift+L
This post has been edited by fogline: Nov 20 2018, 10:44 AM
Go to the top of the page
 
fogline
post Nov 20 2018, 10:45 AM
Post#4



Posts: 69
Joined: 5-August 15
From: Ringgold, GA. USA


I got it working now.
I'm just going to Use Ctrl+Alt


Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

Dim intShiftDown As Integer, intAltDown As Integer
Dim intCtrlDown As Integer

intAltDown = (Shift And acAltMask) > 0
intCtrlDown = (Shift And acCtrlMask) > 0

If intCtrlDown And intAltDown Then
DoCmd.RunMacro "AutoKeys.^+L"
End If

End Sub
Go to the top of the page
 
theDBguy
post Nov 20 2018, 10:57 AM
Post#5


Access Wiki and Forums Moderator
Posts: 75,777
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Pardon me for jumping in... I am happy to see you have a working solution but I think it still does not prevent users from hitting Ctrl+L anywhere in your app to execute the Autokeys macro. I thought you were trying to prevent that. No?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
fogline
post Nov 20 2018, 11:09 AM
Post#6



Posts: 69
Joined: 5-August 15
From: Ringgold, GA. USA


Hi DBguy Good to hear from you..

I just changed it a little. I do not need an AutoKey Macro for this.
If the user clicks Ctrl+Alt on this one form then it will run MyCode which is a "Function MasterLogin()" with some code that I need to run.
All is working great.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

Dim intShiftDown As Integer, intAltDown As Integer
Dim intCtrlDown As Integer

intAltDown = (Shift And acAltMask) > 0
intCtrlDown = (Shift And acCtrlMask) > 0

If intCtrlDown And intAltDown Then
Call MasterLogin
End If

End Sub
This post has been edited by fogline: Nov 20 2018, 11:11 AM
Go to the top of the page
 
theDBguy
post Nov 20 2018, 11:22 AM
Post#7


Access Wiki and Forums Moderator
Posts: 75,777
Joined: 19-June 07
From: SunnySandyEggo


Cool thumbup.gif

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    23rd July 2019 - 06:35 AM