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

How do I get my view back to my database? 1

Status
Not open for further replies.

verizonrep

Programmer
Oct 29, 2002
48
US
Probably a simple one, but it's been a brain fart kind of day.

I have code that is able to export a report (SendObject) through email (Lotus Notes), but when the vb is over it leaves Lotus on my screen and I want the code to bring be back to my application. I've done it once before but that was many moons ago and I can't figure it out.

Any thoughts?
 
Hi

You can use the function "AppActivate"

pass the title of your db as a parameter to pull the focus back to your application.

Sub GetFocusBack()
AppActivate "MyDBTitle"
End Sub



Hope this helps!

Regards

BuilderSpec
 
I am shooting myself on this one. I can't believe it was that easy. I was going down the path of using the hWnd code by setting up a Declaration like:

Option Explicit

Declare Function apiGetActiveWindow Lib "user32" Alias "GetActiveWindow" () As Long
Declare Function apiGetParent Lib "user32" Alias "GetParent" (ByVal hwnd As Long) As Long


And then setting up the code like:

Dim hWnd As Long
Dim hWndAccess As Long

hWnd = apiGetActiveWindow()
hWndAccess = hWnd
While hWnd <> 0
hWndAccess = hWnd
hWnd = apiGetParent(hWnd)
Wend
GetAccesshWnd = hWndAccess


This worked great if I only had one Access application open, but if I had two or more, it gave me a duplication error.


Thanks again. Sometimes the "one liners" work well and should never be overlooked.

I appreciate your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top