Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Click vs keystrokes

Status
Not open for further replies.

MikeCDPQ

Technical User
Sep 11, 2003
173
CA
I have a code that I would like to run either through a menu item on a shortcut menu or from a autokeys (keystroke F8)

Here is the problem piece of code:

Do While CurrentFieldNext = StartingCurrentField
DoCmd.GoToRecord , , acNext
Set CurrentFieldNext = Screen.ActiveControl
Loop

If I press F8 which is my autokeys shortcut it works fine.

If I click my menu item on my shortcut menu it doesn't.

When pressing F8, my loop reads the records values and when the value changes it goes on to do other things.

If however I click to call the same function, the:
Set CurrentFieldNext = Screen.ActiveControl always keeps the value of the first record it encountered and does not change and obviously goes into an endless loop.

Somehow, by clicking on my menu, my control (field) probably looses the focus momentarily and that's what the problem might be.

However, my CurrentFieldName which gives me the name of the current control does give me the right information in either case.

What I am missing ?

Any help will be appreciated as I have been struggling with this for hours and getting to my wits end.

Thanks !

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top