Link to home
Start Free TrialLog in
Avatar of Peborgh
PeborghFlag for United Kingdom of Great Britain and Northern Ireland

asked on

sendkeys funny in access VB with runcommand accmdfind

Access 2002 (XP)

I have the following code to try and persuade the find dialog box to start with correct settings using sendkeys. It works (sometimes but also sets caps lock on!
Come on, Bill gates! Any ideas?

"
    ' do the deed
    Me.this.SetFocus             '!!! whatever the first field is for any form
    SendKeys "%ha%e%rd"   ' any part of form and field and looking down, from MS documentation
    Application.RunCommand acCmdFind

"

Thanks.
Avatar of Leigh Purvis
Leigh Purvis
Flag of United Kingdom of Great Britain and Northern Ireland image

That's the *classic* bug with Sendkeys.

http://www.mvps.org/access/api/api0046.htm
Avatar of Peborgh

ASKER

Err...
I pinched the code, incorporated into my app, compiled OK:

"
    ' do the deed
    Me.this.SetFocus                            '!!! whatever the (first) field is for any form
    FsendKeys "%ha%e%rd"                 ' any part of field and going down (uses a "safe" Sendkeys)
    Application.RunCommand acCmdFind

"
... and it behaves just like the original SendKeys, setting caps lock ON.

What am I missing?

Many thanks,

peter
SOLUTION
Avatar of Leigh Purvis
Leigh Purvis
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Peborgh

ASKER

Anyone out there know of an alternative, specifiable find/findNext proc/func?

Thanks.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Peborgh

ASKER

Getting back to the subject in hand, mySendKeys does work!! I was using Fsendkeys and that acted in the uncorrected way. Blame Bill gates.
So thanks to LPurvis for his help on sendkeys and (oVo) for his finding substiture - that knowledge was useful also.

peter