Sendkeys

Lucky33

Registered User.
Local time
Today, 08:50
Joined
Sep 3, 2011
Messages
57
I am using the SendKeys command (Sendkeys "%ha%n") . It is working on my Windows 7 Access 2003 but it is giving error on Windows 8. Any suggestions?
:confused:
 
There are thousands of errors in windows. Each one with a different message.
What say this one ?
 
the procedure stops and the error message is Run-time error '70: permission denied
 
the user wants to search the records based on Any Part Of a specific field. the code is simple and was working on access 2003:
'
CboFirst.SetFocus
DoCmd.RunCommand acCmdFind
SendKeys "%ha%n"
'
I noticed that when the Find and Replace is activated, the short cut letters are not underlined, until you press the Alt manually first, and i think this is why the SendKeys is not working as there is no letter to respond to the "%" command
thanks
 
Last edited:
I found a very old example I had archived, using SendKeys, and because the

SendKeys "%ha%n", False

is being used to set the Default for the Find Command, i.e. Any Part Of a specific field, my example shows it coming on the line before the Command line

DoCmd.RunCommand acCmdFind

so I think it should be

Code:
CboFirst.SetFocus
SendKeys "%ha%n", False
DoCmd.RunCommand acCmdFind
Linq ;0)>
 
sorry... did not work.. still hanging at that line regardless of is position... there must be something in windows 8 that is preventing the Sendkeys from working as i tried a simpler code just for testing like Sendkeys "{Tab}" and it stopped too
:)
 
Have you tried the workaround from the link in Post #4?

SendKeys has been eschewed by serious developers for so long that I expect the Boys of Redmond have just stopped worrying about keeping it compatible with the newer versions of both Windows and Access. I assume that you know that you can set this behavior, on a machine level, by using Options. Assuming that you're still running Access 2003 (you never said)

  • Choose Options from the Tools menu.
  • Go to the Edit/Find tab
  • Set the Default find/replace behavior to General Search
You can set this programmatically with:

Application.SetOption "Default Find/Replace Behavior",1

If memory serves me correctly (sometimes it does, sometimes it doesn't!) this doesn't change the Default Find Behavior until the code is run, Access, itself, is closed, then restarted. But from then on, it will be the Default.

Linq ;0)>
 
thanks Ling.. this will do to solve my problem... me too i forgot about it completely. i am definitely going to stop using the Sendkeys.
Closing this thread as solved
 

Users who are viewing this thread

Back
Top Bottom