simple function works sometimes??

D

downunderq

Hi,

Recently upgraded from access 2000 to 2003 and using XP pro.

Being lazy, I used various 1 line macros to perform sendkey action to
navigate through my forms and they worked fine in ac2000.

But when I start using ac2003 (without converting to 2003 format), things
start acting strange. Simple macros like sending the " enter " keystrokes
would not work 90% of the time.

After asking for help before, I was advised I should use VBA instead of
using macro to perform these steps. So I wrote a simple simple function to
perform 1 single action, i.e. to send the "enter" keystroke:



Function send_enter_key()


On Error GoTo ERR_SEND_ENTER_KEY

SendKeys "{ENTER}", False

Exit Function

EXIT_SEND_ENTER_KEY:
Exit Function

ERR_SEND_ENTER_KEY:
MsgBox Error$
Resume EXIT_SEND_ENTER_KEY

End Function


The first time I ran it, it perform as expected, but after a while, it stop
working, the cursor will stop at this field and instead of the enter
keystroke being sent, I have to type it myself. And then a few records later
it started working again!!

Have I done something wrong? I used this function in either on enter event
or on got focus event.

Everything else seems to be working ok, I just like to have this working to
achieve consistency in data entry and to save me quite a few keystrokes.

Thanks in advance.

Best regards

Downunderq
 
D

Douglas J. Steele

SendKeys is notorious for not working correctly, and most of us recommend
strongly against using it.

What is it you're trying to do that you think you need to use SendKeys? If
you tell us that, odds are someone will be able to tell you how to do it
"correctly". <g>
 

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