Yeah, that code is not pretty. It's VBA, but it doesn't look like Access VBA to me. It would go in a separate module, and when you got it working you'd call the public function FnSetForegroundWindow(strWindowTitle As String) to find and bring to the foreground the window you were looking for.
UGLY ALTERNATIVE 1:
This line of code will drop access out from in front of Outlook, but there has to be a more elegant solution than making the person re-maximize Access after every email.
Code:
DoCmd.RunCommand acCmdAppMinimize
UGLY ALTERNATIVE 2:
Worst case scenario, you can use SendKeys to send Access the alt-tab command. (Ducks head to avoid incoming objects).
http://msdn.microsoft.com/en-us/libr.../ff192656.aspx for the macro action or
http://msdn.microsoft.com/en-us/libr...ffice.10).aspx for the VBA method.
Sendkeys is considered very squirrelly.
OTHER POSSIBLE ALTERNATIVES:
Here's some other possible ways: http://www.utteraccess.com/forum/Ope...-t1922737.html
QUESTIONS:
What is the actual code that you're using to open Outlook in the first place? Is there a line that looks like
Code:
(something).Display
in it somewhere?
By the way, you should be able to set the message title to something else.