Someone has finally accessed the database window intentionally at work. So I am taking extra steps to secure it, something I had hoped didn't happen.
To hide access to the Database Window or Navigation Pane in 2007.
Sources referred:
http://www.tek-tips.com/viewthread.cfm?qid=925287
http://access.mvps.org/access/api/api0069.htm
http://access.mvps.org/access/general/gen0031.htm
-----------
To show the database window, run
Docmd.SelectObject acTable, , True
To Hide the database window, run
Docmd.SelectObject acTable, , True
Docmd.RunCommand acCmdWindowHide
---------------------------
You can use this function which will return True if the window is currently visible inside the MDI Client window of the application.
'***************** Code Start ***************** ' This code was originally written by Dev Ashish. ' It is not to be altered or distributed, ' except as part of an application. ' You are free to use it in any application, ' provided the copyright notice is left unchanged. ' ' Code Courtesy of ' Dev Ashish ' Private Declare Function FindWindowEx _ Lib "user32" Alias "FindWindowExA" _ (ByVal hwndParent As Long, _ ByVal hwndChildAfter As Long, _ ByVal lpszClass As String, _ ByVal lpszWindow As String) _ As Long Private Declare Function GetWindowLong _ Lib "user32" Alias "GetWindowLongA" _ (ByVal hWnd As Long, _ ByVal nIndex As Long) _ As Long Private Const GWL_STYLE = (-16) Private Const WS_VISIBLE = &H10000000 Public Function fIsDBCVisible() As Boolean ' ' Returns true if the Database container ' window is currently visible ' Dim lngStyle As Long Dim hWnd As Long Const WC_MDICLIENT = "MDIClient" Const WC_DBC = "Odb" ' Find the MDIClient window first hWnd = FindWindowEx(hWndAccessApp, 0, _ WC_MDICLIENT, vbNullString) ' Find the db container window hWnd = FindWindowEx(hWnd, 0, WC_DBC, vbNullString) If (hWnd) Then ' retrieve the window style lngStyle = GetWindowLong(hWnd, GWL_STYLE) fIsDBCVisible = ((lngStyle And WS_VISIBLE) = WS_VISIBLE) End If End Function '***************** Code Start *****************