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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting focus back to MS access

Status
Not open for further replies.

MJD1

Technical User
Jul 18, 2003
134
0
0
CA
hi, I have an access aplication that when opened it first opens an agreement window. When the "I agree" button is selected, it runs several codes, to eventually open the main working form. one of the codes is opening Outlook and when this happens, the focus is set on outlook. How do I get the focus back on Access once Outlook has opened? I tried using the setfocus on my main Form code following the shell command that opens outlook but that didn't work.

thanks
martin
 
What about AppActivate ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
hi PHV, tried different variations of AppActivate and I just can't get it to work! any other suggestions?

thanks
 
MJD1
If you don't mind writing a bit more code...you could try WaitForSingleObject, an example is here:

Beware that this has the effect of making the code you're running to open Outlook synchronous, and if you keep the default of Infinite in the api call your app will hang if outlook hangs or fails during open.
--Jim
 
I put this tip out there for keeping Access on top. Maybe with a little modification, or code placement at the point where it goes to outlook, (or maybe a timer to have it wait a certain amount of time before the code to make access be on top executes) it will work for you.

Keeping MS-Access Application Window on Top
thread705-1642841
 
Martin,

I want to say I've had this issue and had the same bad luck with PHV's recommended method here (PHV is usually right)... Unfortunately I can't seem to remember or find the solution if any I had. However, recognizing the ineffective solution, I decided to search here for that which turned up this...

thread181-1115833

Good luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top