SendKeys not working

8

8020

I have some A2003 code that uses SendKeys to simulate the user pressing the
enter key {ENTER}. Works fine but, I find that the code will only run if the
user has Open Exclusive permission to the dbase. I know that SendKeys is not
a particularly good idea from a security perspective; I plan to rewrite the
code but, need a quick fix for now. Does A/Jet restrict their use unless in
Exclusive mode? Am I missing something? I would appreciate any help on this;
thanks in advance.
 
J

John Spencer

As far as I know, SendKeys is not restricted to only exclusive mode.

What you are attempting to accomplish using SendKeys could be restricted to
exclusive mode. Since you posted no details there is little anyone can do
to determine what you are attempting to do and why it fails.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
8

8020

Hi, thanks for that. Here's the situation:
I have four separate pieces of code that run by the user clicking one of
four command buttons 1,2,3,4. The code has worked perfectly well for a long
time in a multi-user environment. The code in each simply opens a pop up
form with some default data. The user accepts the defaults by pressing enter
(they may very occasionally amend the defaults and then press enter). I
wanted to automatically run all four pieces of code in sequence so I created
a single command button and copied and pasted the four pieces of code into
the stub then did some quick pruning to remove unwanted End Subs etc. I
thought I could quickly solve the problem of eliminating the need to press
enter at the (4) pop-ups by using SendKeys at the appropriate point. It
works well enough but, only if the user has Exclusive permissions. Any
further comment would be appreciated.
 
J

John Spencer

From your description, I see no reason why this would work in exclusive mode
and fail otherwise.

Are you getting error messages?
Have you tried inserting a delay in the code after each send keys?

Personally, I would have written a routine that accomplishes the task
without opening the forms at all and avoids the use of sendkeys.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
8

8020

Yes, I always planned to re-write the code but, was looking for quick
work-around until I could get to it; looks like I'll have to do it sooner
rather than later. No error messages. I'll try the delay after SendKeys;
hadn't thought of that. If that does not fix it I'll go straight for Plan B
(re-write the code). Thanks for your input; much appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

VBA word change keys 0
Sendkeys not working in Access 2007 10
SendKeys with enter 1
sendkeys 0
excel automation and SendKeys "%{ENTER}", True 3
Using SendKeys for Enter 2
SendKeys 3
SendKeys 3

Top