Go to the Tools menu, and look for the Startup option. Uncheck the box that says "Display Database Window".
Of course, this simple approach will only work on users that aren't familiar enough with Access to know to use the F11 key to re-display the database window. Look at the Security FAQs in this forum for a more comprehensive approach to locking out your users.
I wish I could remember where I got the original code from so I could give credit where it's due. I simplified it for my needs. It's just a basic function...
Option Compare Database
Option Explicit
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Public Function fAccessWindow(Optional Procedure As String, Optional SwitchStatus As Boolean, Optional StatusCheck As Boolean) As Boolean
Dim dwReturn As Long
'Allows user to Maximize, Minimize, and Hide MSAccess enviornment window
If Procedure = "Hide" Then
dwReturn = ShowWindow(Application.hWndAccessApp, HIDE)
End If
If Procedure = "Maximize" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SHOWMAXIMIZED)
End If
If Procedure = "Minimize" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SHOWMINIMIZED)
End If
'Allows user to toggle whether MSAccess window is visible
If SwitchStatus = True Then
If IsWindowVisible(hWndAccessApp) = 1 Then
dwReturn = ShowWindow(Application.hWndAccessApp, HIDE)
Else
dwReturn = ShowWindow(Application.hWndAccessApp, SHOWMAXIMIZED)
End If
End If
'Returns boolean value if MSAccess window is visible
If StatusCheck = True Then
If IsWindowVisible(hWndAccessApp) = 0 Then
fAccessWindow = False
End If
If IsWindowVisible(hWndAccessApp) = 1 Then
fAccessWindow = True
End If
End If
End Function
I've had this fossil in my Tools module since about 1993..if you'll notice it even refers back to the Access 2.0 menu.. Don't know where I got it, but it works just fine.
Function HideDBWindow() As Integer
With DoCmd
.Echo False
.SelectObject A_MACRO, "AutoExec", True
.DoMenuItem 1, 4, 3, , A_MENU_VER20
.Echo True
End With
End Function
It does depend on the existance of an AutoExec macro, though, as one way to switch focus to the database window before you hide it. You can use any object in your database though, it doesn't matter - just refer to something else in your SelectObject line.
Remember, you're unique - just like everyone else
You're invited to visit another free Access forum:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.