I posted following problem yesterday and haven't received any suggestions :-( Any idea anyone ?
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 !
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 !