|
|
|
|
|
|
Access
|
Hiding Access Background and Taskbar
|
|
Ease of Use
|
Intermediate
|
Version tested with
|
97, 2000
|
Submitted by:
|
___
|
Description:
|
This code will completely hide the Access background and Access will not be visible on your taskbar OR task manager. WARNING: If you do not use this code correctly, you will need to restart your PC to open your Access application again.
|
Discussion:
|
This code can be used to make MS Access look like a 'stand alone' program. The main problem people have is not setting their forms to modal = yes and popup = yes. If you do not do this, Access will open but will not be visible anywhere on your PC.
|
Code:
|
instructions for use
|
Option Compare Database
Option Explicit
Global Const SW_HIDE = 0
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWMAXIMIZED = 3
Private Declare Function apiShowWindow Lib "user32" _
Alias "ShowWindow" (ByVal hWnd As Long, _
ByVal nCmdShow As Long) As Long
Function fSetAccessWindow(nCmdShow As Long)
Dim loX As Long
Dim loForm As Form
On Error Resume Next
Set loForm = Screen.ActiveForm
If Err <> 0 Then
loX = apiShowWindow(hWndAccessApp, nCmdShow)
Err.Clear
End If
If nCmdShow = SW_SHOWMINIMIZED And loForm.Modal = True Then
MsgBox "Cannot minimize Access with " _
& (loForm.Caption + " ") _
& "form on screen"
ElseIf nCmdShow = SW_HIDE And loForm.PopUp <> True Then
MsgBox "Cannot hide Access with " _
& (loForm.Caption + " ") _
& "form on screen"
Else
loX = apiShowWindow(hWndAccessApp, nCmdShow)
End If
fSetAccessWindow = (loX <> 0)
End Function
|
How to use:
|
- Make sure ALL your forms are set to Popup = Yes and Modal = Yes.
- Make sure that you have proper error handling in all your code.
- Copy the code above and insert it into a new module.
- In your form's 'OnLoad' event, do this: Call fSetAccessWindow(0)
|
Test the code:
|
- Close and reopen your database.
|
Sample File:
|
___A2K.zip 10.26KB
|
Approved by mdmackillop
|
This entry has been viewed 290 times.
|
|