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
Frank S Pappalardo wrote in message <01bee4f6$7bc2bc00$940a6bd8@frankp>...
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/
(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
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>...
Tony Scharf wrote in message <37b9...@news.sisna.com>...
Keri Hardwick <ke...@nospam.sprintmail.com> wrote in message
news:7pcg0o$5br$1...@birch.prod.itd.earthlink.net...
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
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.
>
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
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
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
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 -
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.
My apologies - I wasn't quite clear enough in my moan. My moan was
intended to be specific towards VBA solutions.
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
_____________________________________________________
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
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
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