I am using access 2003.
I have a database with just one form, switchboard form.
I am using this switchboard form as portal to open other database.
What I need is to open switchboard form and hide access application window.
It means that user just see switchboard form no database window no access application window.
I know procedure how to remove database window with start up settings, problem is how to hide access application window.
I used Dev Ashish code, but it is not working.
I put this code in module called basHideAppWindow and
as Dev suggested from switchboard form open event I called the function and passed argument.
fSetAccessWindow function (SW_HIDE)
When I stared application I got error msg. : Cannot hide Access unless " _
& "a form is on screen
And access application window is still on.
What I did wrong?
************ 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
'
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)
'Usage Examples
'Maximize window:
' ?fSetAccessWindow(SW_SHOWM
AXIMIZED)
'Minimize window:
' ?fSetAccessWindow(SW_SHOWM
INIMIZED)
'Hide window:
' ?fSetAccessWindow(SW_HIDE)
'Normal window:
' ?fSetAccessWindow(SW_SHOWN
ORMAL)
'
Dim loX As Long
Dim loForm As Form
On Error Resume Next
Set loForm = Screen.ActiveForm
If Err <> 0 Then 'no Activeform
If nCmdShow = SW_HIDE Then
MsgBox "Cannot hide Access unless " _
& "a form is on screen"
Else
loX = apiShowWindow(hWndAccessAp
p, nCmdShow)
Err.Clear
End If
Else
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(hWndAccessAp
p, nCmdShow)
End If
End If
fSetAccessWindow = (loX <> 0)
End Function
Taras.
Start Free Trial