Solved

sendkeys with ALT does not work

Posted on 2011-02-13
14
555 Views
Last Modified: 2012-05-11
Question 1
I have a macro which contains sendkeys command with argument: %ea
It has worked for long time. Suddenly it does not work properly. It sends the e and a into the control were pointer is.

The same macro in the same database running on another computer  with exactly same operating system (XP Professional), MS Office 2003, etc. still works.

Therefore some settings must have changed in the first computer. But what?
P.S. CONTROL with "^" works properly.

Question 2
I have similar problem with other macros/commands, however, problem occurs occasionally. Again I have the two computers, with same operating system, same MS Access, same database, and some commands and macros work perfectly onl one computer and cause occasional crashes of the database (...MS Access encountered and error ... databse will be closed ...) on other computer, but not always.  
Is there a general notion what such differences may be caused. I have no clue where to start looking.
0
Comment
Question by:vamav
  • 5
  • 4
  • 3
  • +2
14 Comments
 
LVL 10

Assisted Solution

by:Korbus
Korbus earned 125 total points
ID: 34883533
I dont know of any windows setting that would effect this, so I would start with disabling all AntiVirus & security software on the problematic PC.
Have you made ANY other changes/updates to the system recently?
0
 
LVL 75
ID: 34883700
You can also try the usual things ... Compact & Repair the db, reboot the system if you have not.
Occasionally, some programs - for example screen capture programs, which take hold of certain keyboard shortcuts ... check that.
Just some thoughts ...

mx
0
 
LVL 11

Expert Comment

by:RgGray3
ID: 34883743
WAG:  Check the specific computer to see if any of the Windoes Accessability Settings are intercepting the keystroke.

0
 
LVL 57

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 125 total points
ID: 34884159

 While not a direct answer, I'd ditch sendkeys if at all possible.  Very problematic.  All a user has to do is switch focus to another window while your macro is running and the keystroke will end up going to the window that has the focus and not your app.

JimD.
0
 

Author Comment

by:vamav
ID: 34889912
Restarting computer does not help.
Repairing database also did not help.
I even tried with a new test database, it is the same. ALT and SHIFT are not carried out, but CTRL is carried out, i.e ^c works, but !a or %ea does not work, the letters after ! or % are simply sent to the control where the pointer happens to be. Hence  ! and % as keystrokes are not recognized.
no screen capture is active.
0
 
LVL 11

Expert Comment

by:RgGray3
ID: 34890330
Did you check... the Windows Accesability features on the offending machine...
If I understand your problem... It works on some machines and not others...

(The same macro in the same database running on another computer  with exactly same operating system (XP Professional), MS Office 2003, etc. still works.)

So look at the computer not the database....  what makes this computer different?
Service pack level
Accessability features (some of which intercept keystrokes)
0
 

Author Comment

by:vamav
ID: 34890640
Yes, that's how it is. On one computer I have the problem. Same database on other computer with same OS and MS Access 2003, it works.
But originally it worked on both. I did not make any  changes on any setup, unless it was unintentional.
I understand, but I have no experience with these accessibility features. What do I have to check?
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 75
ID: 34890727
Control Panel >> Accessibility Options ...

mx
0
 

Author Comment

by:vamav
ID: 34890874
Yes, I know where it is. But I wanted to say, what do I look for there, what settings?
0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 125 total points
ID: 34890942
I'm not sure. RgGray3 can help with that ...

mx
0
 
LVL 11

Expert Comment

by:RgGray3
ID: 34891006
First check to see if ANY of the options are selected (Filter, Toggle or Sticky keys)

Holding down the shift key too long turns one of them on,..  I keep stumbling on that one....
and there are other times that my shift key becomes WEIRD...  (sorry for using such a technical term  Making fun of myself not you)

At times using the shift stops working and I have to hit a letter twice to get the letter to appear.  or put another way hitting the shift key stops the next key from being sent to the keyboard,

Frustrating and I haven't figured out WHAT is causing that lack of functionality and if anyone has a clue or can tell me how to disable or UNINSTALL accessability ...   it would be appreaceated...

Another thing to research...
Does the offending computer have a different keyboard, or does the keyboard have special (extended) software (such as a multimedia keyboard for media playing, web surfing, special redefinable keys for specialized program access)

It could be the keyboard software.   I have a Lenovo Thinkpad, that has a keyboard utility to define hotkeys.

I'm grasping at straws.... but the point being it does not SEEM to be the program....

You can confirm this by taking the copy of the program OFF of the offending computer and running it on a working computer....   If it works...  you atleast know it is not a damaged mdb.
0
 

Author Comment

by:vamav
ID: 34893486
The problem does not come from keyboard. The key combinations work from keyboard.
But the simulation with the sendkeys command does not work.
So; ALT&e&a from keyboard selects the whole record.
But %ea from the sendkeys command just copies the letter a into the control where the pointer happens to be. But if I send just the "ea", then it copies "ea" into teh control. Apparently it skips the "%e"
The same problem with combinations starting with "!" as teh SHIFT. But it recognizes the ^ sign as CTRL. So, ^c works, but %ea does not work.
I checked  versions of the database several months old which worked before and there it is now the same. So the problem must really come from Access or Windows but not from database.
0
 
LVL 11

Accepted Solution

by:
RgGray3 earned 125 total points
ID: 34893556
Again ....  Eliminate the Database itself by taking a copy from the non-working computer to another computer where it has worked...

If it works there... it is not the Access MDB  we have eliminated any physical problem within the MDB
Then it is either the installation of Access. or the computer...

Check the service pack levels on two different machines...  (one that works and the one that does not)

something must be intercepting the keystroke...
0
 

Author Closing Comment

by:vamav
ID: 35010500
It now works again, but I still am not sure how it came about. Hope it stays so.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now