Jeanette Cunningham replied to agf
17-Nov-09 03:23 PM

Here is some code by Dirk Goldgar MVP, that should do what you want.
Returns True if the Access Navigation Pane or Database Window is visible,
otherwise False.
' Example: ?isDbWindowVisible()
Public Function isDbWindowVisible() As Boolean
Dim hWindow As Long
If Int(SysCmd(acSysCmdAccessVer)) >= 12 Then ' Access 2007 Navigation
Pane
hWindow = FindWindowEx(Application.hWndAccessApp, 0,
hWindow = FindWindowEx(hWindow, 0, "NetUIHWND", vbNullString)
Else ' Access 20003 Database Window
hWindow = FindWindowEx(Application.hWndAccessApp, 0, "MDIClient",
vbNullString)
hWindow = FindWindowEx(hWindow, 0, "Odb", vbNullString)
End If
isDbWindowVisible = (isWindowVisible(hWindow) <> 0)
End Function
The above code can be used to hide the Navigation Pane such as in the
function below:
' Hide the Access Database Window or Navigation Pane.
' Example: DbWindowHide
Function DbWindowHide() As Boolean
If isDbWindowVisible() Then
Application.Echo False
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia