Rick,
I Could have sworn I tested that before I posted my message. But when I
just did it again, I find that you are absolutely correct. Maybe it was
only working when I moved between objects in the Access window.
I found an API call GetActiveWindow and called it in the forms OnTimer
event. It returned the same numeric value for any form that was active in
the Access window, but returned a zero (0) for every other application I
tested, except the VBA Editor window. All I had to do was declare this
function:
Declare Function GetActiveWindow Lib "user32" () As Long
in a code module and every time the OnTimer event fired for the form, it
returned a numeric value (usually zero, but not in Access or in the VBA Code
Editor window)
So I think this would work in that the timer event could check to see
whether the value returned by GetActiveWindow is the same as the value for
the Access database window. Might need to tweak the timerinterval so that
when the GetActiveWindow returns the value for the Access window, the timer
interval is every minute or so, and as soon as these values differ, it
changes the interval to more frequent (maybe 500). Then just set a flag or
call a specific code segment when the value changes from other than Access
to Access.
Dale