Is there anyway I can hide the main Access window >so that the application looks similar to a Visual Basic application ? > >Thanks in advance for all your
i did the following perfectly.. everything was running superb but at the time of viewing report, was unable to close,minimize the report-view - the i have to close the application n start again otherwise the report view will be there and as many report-view u open it will be there unless u quit the application.. something help me !!
the code i entered as follows :-
1. Copy the code at the bottom of this FAQ into a module. I named mine basAccessHider, but it really doesn't matter.
2. Create a macro and call it mcrHide. The Macro has one Action line - RunCode - and put the following in the Function box:
fAccessWindow ("Minimize", False, False)
3. Create another macro and call it mcrRestore. The Macro has one Action line - RunCode - and put the following in the Function box:
fAccessWindow ("Show", False, False)
4. Now the property changes.....you have set every form in your database to PopUp....find the PopUp property for each form and set it to yes. In the OnOpen event of your startup form (if you don't have a startup form, just pick the first form you open when you open the database), put the following code:
DoCmd.RunMacro "mcrHide"
5. Finally, to allow reports to be previewed...in every report you will need to put:
In the OnOpen: DoCmd.RunMacro "mcrRestore"
In the OnClose: DoCmd.RunMacro "mcrHide"
And that's about it. Not a lot of work, but it can seem confusing.
''''
' Start Code '
''''
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Dim dwReturn As Long
Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3
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
If Procedure = "Hide" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
End If
If Procedure = "Show" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
End If
If Procedure = "Minimize" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMINIMIZED)
End If
If SwitchStatus = True Then
If IsWindowVisible(hWndAccessApp) = 1 Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
Else
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
End If
End If
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
'''
' End Code '
'''
i did the following perfectly.. everything was running superb but at the time of viewing report, was unable to close,minimize the report-view - the i have to close the application n start again otherwise the report view will be there and as many report-view u open it will be there unless u quit the application.. something help me !!
the code i entered as follows :-
1. Copy the code at the bottom of this FAQ into a module. I named mine basAccessHider, but it really doesn't matter.
2. Create a macro and call it mcrHide. The Macro has one Action line - RunCode - and put the following in the Function box:
fAccessWindow ("Minimize", False, False)
3. Create another macro and call it mcrRestore. The Macro has one Action line - RunCode - and put the following in the Function box:
fAccessWindow ("Show", False, False)
4. Now the property changes.....you have set every form in your database to PopUp....find the PopUp property for each form and set it to yes. In the OnOpen event of your startup form (if you don't have a startup form, just pick the first form you open when you open the database), put the following code:
DoCmd.RunMacro "mcrHide"
5. Finally, to allow reports to be previewed...in every report you will need to put:
In the OnOpen: DoCmd.RunMacro "mcrRestore"
In the OnClose: DoCmd.RunMacro "mcrHide"
And that's about it. Not a lot of work, but it can seem confusing.
''''
' Start Code '
''''
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Dim dwReturn As Long
Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3
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
If Procedure = "Hide" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
End If
If Procedure = "Show" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
End If
If Procedure = "Minimize" Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMINIMIZED)
End If
If SwitchStatus = True Then
If IsWindowVisible(hWndAccessApp) = 1 Then
dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
Else
dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
End If
End If
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
'''
' End Code '
'''