Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Who is turning off my NumLock?

634 views
Skip to first unread message

Frank S Pappalardo

unread,
Aug 12, 1999, 3:00:00 AM8/12/99
to
This is strange. Has this happened to anyone?

Periodically, when I am using a particular Access 97 application, my
NumLock gets turned off! This happens on different computers, but only with
this one database, and (we think, but aren't sure) only with one particular
form. There's a good bit of code behind it - any ideas where I should look?

TIA,
Frank
--
Frank S. Pappalardo, Computer HELP
Email: fr...@fpappalardo.com
Web: http://www.fpappalardo.com


Keri Hardwick

unread,
Aug 12, 1999, 3:00:00 AM8/12/99
to
Mr. SendKeys is your culprit.

Keri
Frank S Pappalardo wrote in message <01bee4f6$7bc2bc00$940a6bd8@frankp>...

Ron

unread,
Aug 12, 1999, 3:00:00 AM8/12/99
to
I have the same problem.... i am interested if there is an answer

Paul Bredbury

unread,
Aug 12, 1999, 3:00:00 AM8/12/99
to
In article <19990812152942...@ng-fp1.aol.com>,
rkfl...@aol.com says...

> I have the same problem.... i am interested if there is an answer

Don't use SendKeys. With the squillion options available with
DoCmd.RunCommand (explained at the link below), the only thing that
*requires* SendKeys AFAIR is the ability to switch from one database to
another in the same Access session.

http://www.tkwickenden.clara.net/

--
Paul Bredbury, http://dialspace.dial.pipex.com/brebs/

Frank S Pappalardo

unread,
Aug 13, 1999, 3:00:00 AM8/13/99
to
Found the answer:

(Q) When I run some code in a form, the Numlock key sometimes turns itself
off. Why is this happening?

(A) There is a well known bug in all versions of Access involving SendKeys
switching off the Numlock key. There are very few occasions where Sendkeys
is absolutely required and the best answer to this problem is to try and
avoid it's use.

(posted by Terry Kreft, on Dev's website: http://www.mvps.org/access/)


Frank S Pappalardo <fr...@fpappalardo.com> wrote in article

Tony Scharf

unread,
Aug 17, 1999, 3:00:00 AM8/17/99
to
Ok, so sendkeys is doing this. how do i get it to not do this (i didnt
generate the article, but I have the same problem with one particular app).

Thanks
Tony

In article <7ov6qj$he6$1...@holly.prod.itd.earthlink.net>,
ke...@nospam.sprintmail.com says...


>
>Mr. SendKeys is your culprit.
>
>Keri

>Frank S Pappalardo wrote in message <01bee4f6$7bc2bc00$940a6bd8@frankp>...

Patrick Fisher

unread,
Aug 17, 1999, 3:00:00 AM8/17/99
to
Tony
All you can do is not use sendkeys, find another way to do whatever sendkeys
is doing
Patrick

Tony Scharf wrote in message <37b9...@news.sisna.com>...

Keri Hardwick

unread,
Aug 17, 1999, 3:00:00 AM8/17/99
to
You solve it by not using SendKeys.

SweetMichael

unread,
Aug 20, 1999, 3:00:00 AM8/20/99
to
My sympathy to the response you got on this, Tony. Like yourself I have no
knowledge of this "send keys" and this latest responder obviously didn't
understand your question, which was "how do I not use SendKeys" (or else he
wouldn't have just repeated your question backwards). I guess you and I will
have to do the obvious and start searching the help files. Although Keri
hasn't provided us with a usable answer he/she has given us a clue instead.
Maybe thats just as well - always good to learn things on our own.

Keri Hardwick <ke...@nospam.sprintmail.com> wrote in message
news:7pcg0o$5br$1...@birch.prod.itd.earthlink.net...

Paul Bredbury

unread,
Aug 20, 1999, 3:00:00 AM8/20/99
to
In article <7pjn5k$8rs$1...@news.mr.net>, sweetm...@netzero.net says...

> My sympathy to the response you got on this, Tony. Like yourself I have no
> knowledge of this "send keys" and this latest responder obviously didn't
> understand your question, which was "how do I not use SendKeys" (or else he
> wouldn't have just repeated your question backwards).

When you ask a generic question, expect a generic answer (if you're lucky
enough to receive an answer). You can safely assume that none of the
people who see your posts have psychic abilities.

I have pointed in the direction of the RunCommand constants, and provided
an Internet link to a person's web site (that person has carefully
catalogued the constants, and through the goodness of his heart made the
catalogue available to the public). Why do you think I did that?

> I guess you and I will
> have to do the obvious and start searching the help files. Although Keri
> hasn't provided us with a usable answer he/she has given us a clue instead.
> Maybe thats just as well - always good to learn things on our own.

Correct. You cannot expect perfect, easy answers to any questions you
may feel willed to ask, for free. The people who answer questions are
merely people too.

If you check Deja News, filtering on this newsgroup and the keyword
"Sendkeys", you will see this issue raised and answered a squillion
times.

http://www.deja.com/home_ps.shtml

Keri Hardwick

unread,
Aug 20, 1999, 3:00:00 AM8/20/99
to
Without knowing how or where you are using SendKeys, there's no way to
suggest an alternative. That command is used to send any combination of
keystrokes - how could I possibly know what to tell you to do?

Look through all your modules, form and report code and macros for the word
SendKeys. If you can't figure out what to do when you find it, post again
telling us what keys you are sending.

And yes, if you encounter an unfamiliar term in an answer here, look in Help
and see what it is.

Keri
SweetMichael wrote in message <7pjn5k$8rs$1...@news.mr.net>...


>My sympathy to the response you got on this, Tony. Like yourself I have no
>knowledge of this "send keys" and this latest responder obviously didn't
>understand your question, which was "how do I not use SendKeys" (or else he

>wouldn't have just repeated your question backwards). I guess you and I


will
>have to do the obvious and start searching the help files. Although Keri
>hasn't provided us with a usable answer he/she has given us a clue instead.
>Maybe thats just as well - always good to learn things on our own.
>

Radu Lascae

unread,
Aug 20, 1999, 3:00:00 AM8/20/99
to
SendKeys is _very_ poor programming and should not be used for various reasons,
all of which boil down to this: they are likely to bring about unexpected and
potentially dangerous results. In the extreme, they will format the hard disk.

One reason is that applications run asynchonuosly in a multitasking environment,
meaning that the user can switch from one open window to another, in the same
application or to another application. However, the keys are still sent, making
the results unpredictable.

Another problem is when working in an environment with applications using mixed
languages. A much asked question here is: how can I open the standard search
dialog with the default set, for example, to "Any part of field". An asnwer once
given was: open the dialog then SendKeys "%ha%n", False (Alt+H, A, Alt+N). My
answer to users wanting this is: sorry, can't do it. Why? Because some use an
English interface, others a Dutch one, where the above should be SendKeys
"%ng%z", False. I also have somebody from Finland, on a temporary basis, who's
well within his rights to use his Finish language version on his laptop. Should
I code this for Finish, too?

So the answer is really: don't use SendKeys. Alternative? Impossible to say if
the original poster doesn't state what he/she tries to achieve by using
SendKeys. Can't see this information in the original message.

Radu Lascae

Ron

unread,
Aug 20, 1999, 3:00:00 AM8/20/99
to
well here is my input - and also similar problem... I also have a problem with
num lock key - I do however have a macro the uses the sendkeys command -

i use it because i dont want the user to have to answer "yes" to question -
example i have queries running that updates / creates / deletes tables - so i
use send keys to answer the "yes" questions for the use -

is this the best way??? its the only way i know how - seeing how i am a novice
at this - any suggestion?

thanks

Keri Hardwick

unread,
Aug 20, 1999, 3:00:00 AM8/20/99
to
Yes there is a better way. In this instance, use the SetWarnings action (in
a macro) or DoCmd.SetWarnings (code) to turn the messages off. Be sure to
turn them back on when you are finished.

Keri
Ron wrote in message <19990820130742...@ng-ch1.aol.com>...


>well here is my input - and also similar problem... I also have a problem
with
>num lock key - I do however have a macro the uses the sendkeys command -
>
>i use it because i dont want the user to have to answer "yes" to

Radu Lascae

unread,
Aug 20, 1999, 3:00:00 AM8/20/99
to
Hi Ron,

The alternative to SendKeys here is to use
Docmd.SendWarnings False
'run the query
Docmd.SendWarnings True

This is in code, there is a SetWarnings commands that can be used from
macros. They will never see that message. Don't forget to turn it back
on! In other places, you may choose to show the messages.

Hth,
Radu Lascae

Ron wrote:
>
> well here is my input - and also similar problem... I also have a problem with
> num lock key - I do however have a macro the uses the sendkeys command -
>

> i use it because i dont want the user to have to answer "yes" to question -

Paul Bredbury

unread,
Aug 20, 1999, 3:00:00 AM8/20/99
to
In article <7pk3go$7fj$1...@ash.prod.itd.earthlink.net>,
ke...@nospam.sprintmail.com says...

> Yes there is a better way. In this instance, use the SetWarnings action (in
> a macro) or DoCmd.SetWarnings (code) to turn the messages off. Be sure to
> turn them back on when you are finished.

Or use the Execute method (code), and don't have to worry about
SetWarnings at all. In my databases, I never have to worry about
warnings, because I never have to mess with them.

I really don't understand why people keep giving advice involving having
to toggle warning messages, and using an inferior method of query
execution, when the Execute method is readily available and superior.

Paul Bredbury

unread,
Aug 21, 1999, 3:00:00 AM8/21/99
to
In article <37c9c5df....@netnews.worldnet.att.net>,
cdotg...@worldnetdotattdot.net says...
> The alternative is to not answer questions where the user is looking
> for a macro solution. That at least gets them up and running, and
> resolves the immediate problem.

My apologies - I wasn't quite clear enough in my moan. My moan was
intended to be specific towards VBA solutions.

Peter Miller

unread,
Aug 22, 1999, 3:00:00 AM8/22/99
to

On your original point (ie, SetWarnings is a bad choice), I agree
full-heartedly.

I occassionally do some consulting work for a company where the default is to
use SetWarnings to avoid the many 'Do you want to save?' questions that appear
when code has been modified in multiple open forms. Because the applications
worked on have hundreds of forms, hundreds more reports and a bunch of queries,
using SetWarnings allows the programmer to make changes across objects, then
automatically have all work saved. It saves time.

Problem is that the application always reflects the latest changes, whether or
not those modifications to the code were correct or intended. It seems safer to
me to take the time to actually answer 'yes' to the objects whose changes were
intentionally and meaningful, and to have the opportunity to say 'no' to objects
for which changes were made but not required.

It also stops the annoying create-a-temporary-query >> run-the-query >>
close-the-query-not-intending-to-save-it >> get-prompted-for-a-name >>
click-cancel >> come-back-into-the-query >> try-and=close-it-again >>
get-asked-for-a-name-again >> type-in-something-bogus >> exit-the-screen >>
delete-the-saved-query >> revert-setwarnings-to-false cycle that seems to happen
whenever code is halted for debugging purposes in between setting setwarnings to
true and setting it back to false.

On Sat, 21 Aug 1999 17:30:51 +0100, br...@dial.pipex.com (Paul Bredbury)'s
machine spontaneously emitted the following random collection of characters:

>In article <37c9c5df....@netnews.worldnet.att.net>,
>cdotg...@worldnetdotattdot.net says...
>> The alternative is to not answer questions where the user is looking
>> for a macro solution. That at least gets them up and running, and
>> resolves the immediate problem.
>
>My apologies - I wasn't quite clear enough in my moan. My moan was
>intended to be specific towards VBA solutions.


Peter Miller
PK Solutions
_____________________________________________________

For Microsoft Access related tools and services,
including our Data Recovery Rescue Service for
Microsoft Access, please visit our site (below)...
_____________________________________________________

www: www.pksolutions.com
e-mail: pmi...@pksolutions.com

Tel: +1 (858) 613-0284 x7 Fax: +1 (858) 613-0283
_____________________________________________________

Frank S Pappalardo

unread,
Aug 23, 1999, 3:00:00 AM8/23/99
to

Radu Lascae <R.La...@ind.tno.nl> wrote in article
<37BD6D10...@ind.tno.nl>...
> (snip)


> So the answer is really: don't use SendKeys. Alternative? Impossible to
say if
> the original poster doesn't state what he/she tries to achieve by using
> SendKeys. Can't see this information in the original message.

Radu, thanks for your response on why using SendKeys is bad. I will try to
heed your advice!

Here is why I used it in the first place: I have a dialog box form with 2
combo boxes; cboCompany and cboLocation. On cboCompany_AfterUpdate, I set
cboLocation.RowSource accordingly. If there is only one location for that
company, I want to eliminate the need for the user to select that location.
So I use SendKeys, like so:

Me.cboLocation.SetFocus
SendKeys "%{DOWN}{DOWN}{TAB}"

Is there another way?

--
Frank S. Pappalardo, Computer HELP

Email: fr...@nospam.fpappalardo.com
Web: http://www.fpappalardo.com
Get paid for what you know. Join the Hand Team:
http://www.handteam.com/default.asp?HOST=fpappalardo
Visit our Storefront for all your computer needs:
http://www.handtech.com/default.asp?HOST=fpappalardo


Radu Lascae

unread,
Aug 23, 1999, 3:00:00 AM8/23/99
to
Hi Frank,

I guess I've called this upon myself, haven't I?:-)

Frank S Pappalardo wrote:
[snip]


> So I use SendKeys, like so:
>
> Me.cboLocation.SetFocus
> SendKeys "%{DOWN}{DOWN}{TAB}"

Yes. The _exact_ replacement for SendKeys is:
Me.cboLocation.DropDown
Me.cboLocation.listindex = 0 'select first item
Me.theNextControlInTheTabOrder.SetFocus

If the purpose of this is just to select the item, you don't need
neither of DropDown and the second SetFocus. It also gets rid of that
flashing on the screen when the combo gets dropped.

Hth,
Radu Lascae

Stephen Lebans

unread,
Aug 23, 1999, 3:00:00 AM8/23/99
to
Hi Radu,
you solved the very first question I asked in this NG and you are still
teaching me! :-)

The Access Help Files say this about the LISTINDEX property.
This property is available only by using a macro or Visual Basic. You
can read this property only in Form view and Datasheet view. This
property is read-only and isn't available in other views.

Even so I've tried it a couple of times in the past just to make sure
the Help files are accurate. I always generated a runtime error trying
to write to the ListIndex property.

Now you come along and casually tell Frank to go ahead and write to this
property. Ok, I go back and try it again and it still bombs. I then
decide to try your example directly and I decide to add a SetFocus
before the CBO.DropDown and of course it works.

So the Help file is wrong. If the Combo or ListBox has the Focus, you
can write to the ListIndex property. Radu I am not writing this to tell
you something you already know. It is for my benefit and the benefit of
the lurkers out there.

Thanks again Radu!

--
Stephen Lebans
maca...@nbnet.nb.ca
http://www.geocities.com/~slebans/

Radu Lascae wrote
SNIP> >


> > Me.cboLocation.SetFocus
> > SendKeys "%{DOWN}{DOWN}{TAB}"
>
> Yes. The _exact_ replacement for SendKeys is:
> Me.cboLocation.DropDown
> Me.cboLocation.listindex = 0 'select first item
> Me.theNextControlInTheTabOrder.SetFocus

SNIP


0 new messages