SendKeys problem w/Win10 (1 Viewer)

esskaykay

Registered User.
Local time
Today, 15:41
Joined
Mar 8, 2003
Messages
267
I’m having a problem with the SendKeys command.

I have an older Access 2003 routine that I have been using for years running under Win7 that does exactly what I want. However, I have moved it to one of my Win10 machines and now bombs on one small function. I have my UAC set to Never Notify.

Private Sub Command5_Click()
SendKeys "{F11}"
End Sub

I assume this is a windows issue not Access but have not been able to resolve. Is the SendKeys command not available when running Windows 10? I have searched for resolutions but have been unsuccessful. Any suggestions would be greatly appreciated.

Thanks,
Steve K.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:41
Joined
Oct 29, 2018
Messages
21,358
Hi Steve. You should be able to use SendKeys in Windows 10. What does "bombs" mean?
 

esskaykay

Registered User.
Local time
Today, 15:41
Joined
Mar 8, 2003
Messages
267
Hi Steve. You should be able to use SendKeys in Windows 10. What does "bombs" mean?

I recieve a Run-Time Error 70 - Permission Denied.

See Attachment.
 

Attachments

  • Run-Time Error 70.pdf
    23.8 KB · Views: 150

theDBguy

I’m here to help
Staff member
Local time
Today, 08:41
Joined
Oct 29, 2018
Messages
21,358
I recieve a Run-Time Error 70 - Permission Denied.

See Attachment.
Interesting. I wonder what permission you are being denied. How about trying out SendKeys commands in the Immediate Window?
 

Micron

AWF VIP
Local time
Today, 11:41
Joined
Oct 20, 2018
Messages
3,476
Hi Steve. You should be able to use SendKeys in Windows 10. What does "bombs" mean?
Did you look first? There's tons of posts saying it is no longer supported - some of which at least say why. It's apparently a security issue.

Or are you including the possibility if you use a Windows API, which isn't really the same thing?
 
Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 15:41
Joined
Sep 21, 2011
Messages
14,044
FWIW using theDBguy's suggestion, I can run it in the immediate window on Win10 pro.
I have UAC switched off though.?
The command does not appear to do anything on my computer, but does not complain either.

If I use F8 in the immediate window and have a breakpoint in code, it will move to the next line of code.?

HTH
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:41
Joined
Oct 29, 2018
Messages
21,358
Did you look first? There's tons of posts saying it is no longer supported - some of which at least say why. It's apparently a security issue.

Or are you including the possibility if you use a Windows API, which isn't really the same thing?
Hi. Thanks! Actually, I didn't look because I wasn't aware it was a problem, probably because I don't normally use SendKeys anyway. So, after your prompt, I tried to look it up and found this previous discussion on the same topic and offered an alternate solution. Hope it helps the OP. Cheers!
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 08:41
Joined
Oct 29, 2018
Messages
21,358
Hi. Thanks! Actually, I didn't look because I wasn't aware it was a problem, probably because I don't normally use SendKeys anyway. So, after your prompt, I tried to look it up and found this previous discussion on this topic and offered an alternate solution. Hope it helps the OP. Cheers!
However, just as a test, I opened up Access on a Windows 10 machine and went to the Immediate Window. I got the following results:




Basically, first, I entered
Code:
sendkeys "?date()"
expecting to see the current date show up, but I obviously misinterpreted what sendkeys are used for. However, as you can see, it worked as it was supposed to.

Next, I entered
Code:
sendkeys "{f5}"
and this time, I got exactly what I was expecting, it opened the Macros window waiting for me to select a procedure to run.

So, what gives? Did I miss something or not understanding what's supposed to be happening here? If Sendkeys is not supposed to work in Windows 10, is it still supposed to work in the Immediate Window?
 

Attachments

  • sendkeys.png
    sendkeys.png
    3.1 KB · Views: 1,195
  • macro.png
    macro.png
    8.3 KB · Views: 1,275
Last edited:

esskaykay

Registered User.
Local time
Today, 15:41
Joined
Mar 8, 2003
Messages
267
Thanks guys for your input. I received the same error when I entered SendKeys "{F11}" in the Intermediate Window. Apparently Win10 does not like SendKeys. I did do a search of this but was unable to find a resolution (probably just me). Any other ideas?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:41
Joined
Oct 29, 2018
Messages
21,358
Thanks guys for your input. I received the same error when I entered SendKeys "{F11}" in the Intermediate Window. Apparently Win10 does not like SendKeys. I did do a search of this but was unable to find a resolution (probably just me). Any other ideas?
Hi Steve. Did you see the link I posted in my earlier response? It gives you an alternate approach to using Sendkeys. However, I just tried it on my Windows 10 machine and entered
Code:
sendkeys "{f11}"
in the Immediate Window and didn't get any errors. So, this must mean there is a "permission" issue with your machine. For example, can you enter the following in your Immediate Window?
Code:
sendkeys "Hello World!"
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:41
Joined
Sep 21, 2011
Messages
14,044
Apparently Win10 does not like SendKeys. I did do a search of this but was unable to find a resolution (probably just me). Any other ideas?

Not the case at all. Both theDBguy and myself have said it works fine on our computers.?
 

esskaykay

Registered User.
Local time
Today, 15:41
Joined
Mar 8, 2003
Messages
267
OKAY, must be something setup goofy on my Win10 machine. When I entered:
SendKeys "Hello world" in the Intermediate Window I received the same Run-Time Error 70 - Permission Denied. Any ideas what could be set wrong on my end?
 

esskaykay

Registered User.
Local time
Today, 15:41
Joined
Mar 8, 2003
Messages
267
As a test I ran it on a similar Dell XPS13 laptop with Win10 -- same result. Maybe it's something with Dell XPS13's? I suspect not - still assume I have some Win10 settings wrong. I'd don't remember changing anything on either of these machines but may have.
 

isladogs

MVP / VIP
Local time
Today, 15:41
Joined
Jan 14, 2017
Messages
18,186
Firstly I can also confirm SendKeys works in Windows 10...though its use isn't recommended in any version of Access/Windows for reasons of reliability...

As an example, using SendKeys "{F1}" should open Access help

If you are getting Permission denied errors then
a) you may have more than one copy of Access open - check in task manager
b) you may have corruption in either your app or Access itself - try DECOMPILING your app and/or reinstalling Access
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:41
Joined
Sep 21, 2011
Messages
14,044
Tried it in code from a form and mine hides/reveals the navigation window correctly.?
 

esskaykay

Registered User.
Local time
Today, 15:41
Joined
Mar 8, 2003
Messages
267
Tried it in code from a form and mine hides/reveals the navigation window correctly.?

Yeah, it's got to be something with my Win10 setup. No idea how to resolve. Oh well - much appreciation you all for your intense concern and help. For now I'm going to have to move on.

Again, my thanks....
 

isladogs

MVP / VIP
Local time
Today, 15:41
Joined
Jan 14, 2017
Messages
18,186
Yeah, it's got to be something with my Win10 setup. No idea how to resolve. Oh well - much appreciation you all for your intense concern and help. For now I'm going to have to move on.

Again, my thanks....

Have you tried my suggestions in post #14?
 

esskaykay

Registered User.
Local time
Today, 15:41
Joined
Mar 8, 2003
Messages
267
Have you tried my suggestions in post #14?

Yes I even rebooted to be sure only one instance of Access was running. I tried running Access with no tables, etc. – only Immediate Windows and keyed in SendKeys “Hello”. I still received the Run-Time 70 error – Permission Denied. I tried it on two different (but similar) machines with same results so I don’t think it’s a problem with the Access installation.
 

isladogs

MVP / VIP
Local time
Today, 15:41
Joined
Jan 14, 2017
Messages
18,186
Did you decompile your app? Also did you check for missing references?
 

Users who are viewing this thread

Top Bottom