Thanks Nigel. The reports now open as they should but access gets open as well in the background (I can see the ribbon, tables, queries, etc).
Is there a way to re-hide everything once the report is open?
Thanks,
Thanks for the reply Nigel. The database you attached works fine on it's own, but again when I link to it via a hyperlink from another database it doesn't work the same way... The access window appears in the background...
Hi,
it can be done with vba code-
you call it like this-Code: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
you form has to be popup though otherwise, it will disappear with the database window.....Code:fSetAccessWindow(SW_SHOWMINIMIZED)
Cheers
Nidge
Option Compare Database
Private Sub Form_Open(Cancel As Integer)
Me.Visible = True
fSetAccessWindow (SW_HIDE)
End Sub
I realize this is a very old thread, but as I'm still learning Access 2010, can someone tell me where the above code needs to be placed, and where it should be called from?
Thanks so much...
Jim
Hi,
it can be done with vba code-
Code: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
you call it like this-
you form has to be popup though otherwise, it will disappear with the database window.....Code:fSetAccessWindow(SW_SHOWMINIMIZED)
Cheers
Nidge