Send keys : %{down}

A

Amy

Hi everyone,

Macro: mcrDown
Action: Sendkeys
Keystrokes: %{down}
Wait: Yes

Event
On Enter: mcrDown

I've created a macro that runs On Enter event. When you
tab over to a field linked to a lookup table, you will
automatically see the possible selections. When I tried
inputting on front-, back-end databases on the same drive,
everything was ok. But when I moved the back-end to the
server, and scrolled back to previously inputted records,
if the cursor is on a field linked to a lookup table, the
records move very quickly and the previously entries may
change (e.g. From Name = ABC to Name = CDE). Is this a
problem with the server or is it something else? Any
solutions besides removing the macro? Thanks for any help.

Amy
 
N

Nikos Yannacopoulos

Amy,

SendKeys is bad, bad, bad... as a general rule, it is to be avoided at any
cost. The problem with it is that it sends the keystrokes the moment you run
it, not taking into account the environment, so the keystrokes may end up
somewhere else from where they were intended, producing unexpected results.
My guess is in your case the small time delay introduced by the network
results in the keystrokes being sent a fragment of a second before the data
is loaded.
There are more robust ways to do anything you are trying to do with
SendKeys. In your case, I understand you want to expand a combo box. My
suggestion is to use a line of code instead of a macro with SendKeys:

Me.ActiveControl.Dropdown

HTH,
Nikos
 

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

Top