Hiding Access

speakers_86

Registered User.
Local time
Today, 09:06
Joined
May 17, 2007
Messages
1,919
If a form is minimized, how can I get that instance of access to minimize? Also, is there a way to get access to not be shown while a form is open on the screen?
 
If a form is minimized, how can I get that instance of access to minimize? Also, is there a way to get access to not be shown while a form is open on the screen?
Yes, it is possible (a bit of a pain but possible).

1. All forms have to be set as Popup.

2. You use the DoCmd.AppMinimize or DoCmd.RunCommand acCmdAppMinimize
And AppMaximize to deal with the Access Window.

3. It used to be that Reports wouldn't show unless the window was brought back up again. I'm not sure if that is still true.
 
2. You use the DoCmd.AppMinimize or DoCmd.RunCommand acCmdAppMinimize
And AppMaximize to deal with the Access Window.

What event should I put that in? There is no on minimize. :(
I tried on resize, but of course that isnt a good way to do it. Docmd.appminimize doesnt work in A2007.
 
What event should I put that in? There is no on minimize. :(
I tried on resize, but of course that isnt a good way to do it. Docmd.appminimize doesnt work in A2007.
You would use

DoCmd.RunCommand acCmdAppMinimize

in the starting form's On Open event.
 
Okay, thats not too bad for frmLogin.


For frmHome, when this form is minimized, is there a way to get that instance of access to minimize, instead of just the form?
 
You have to manage all of that within your forms. (like I said, it is a pain to do)
 
Alright, Ive got it working with one flaw. Heres my solution, thanks to this site.

Code:
Option Compare Database

Option Explicit

Declare Function IsZoomed Lib "User32" (ByVal hWnd As Long) As _
     Integer
Declare Function IsIconic Lib "User32" (ByVal hWnd As Long) As _
     Integer

And here is the code in the form

Code:
Option Compare Database
'===================================================================
'Property Maximized
'
'This procedure uses the Property Get statement to define the custom
'form property 'Maximized' by calling the IsZoomed() function.
'
'Return Value:
'    True(-1) - The form is maximized.
'    False(0) - The form is not maximized.
'
'====================================================================

Public Property Get Maximized() As Integer
     Maximized = IsZoomed(Me.hWnd) * -1
End Property

'====================================================================
'Property Minimized
'
'This procedure uses the Property Get statement to define the custom
'form property 'Minimized' by calling the IsIconic() function.
'
'Return Value:
'    True(-1) - The form is minimized.
'    False(0) - The form is not minimized.
'
'====================================================================

Public Property Get Minimized() As Integer
     Minimized = IsIconic(Me.hWnd) * -1
End Property


Code:
Private Sub Form_Resize()
     If Forms!frmhome.Minimized Then
         DoCmd.RunCommand acCmdAppMinimize
         Else
         DoCmd.RunCommand acCmdAppMaximize
     End If

End Sub



That works fine. Heres my only problem. When access is first opened, frmLogin opens, and access minimized just as it should be. But if access is already opened (either through shift bypass or cmdlogout on click which opens frmLogin), everything is minimized. FrmLogin and all.

Here is all the related code.

cmdLogout on frmHome calls this.
Code:
Function CloseAllForms()

     'It will close all forms before opening the new form (if required)

     Dim obj As Object
     Dim strName As String
DoCmd.Close acForm, "frmlogin"
     For Each obj In Application.CurrentProject.AllForms
    DoCmd.Close acForm, obj.Name, acSaveNo
    Next obj
    
         For Each obj In Application.CurrentProject.AllReports
    DoCmd.Close acReport, obj.Name, acSaveNo
    Next obj
DoCmd.OpenForm "frmlogin"
DoCmd.RunCommand acCmdAppMaximize

    End Function


Here is the on close command for frmhome
Code:
Private Sub Form_Close()
If Isloginopen("frmlogin") = False Then
Else
DoCmd.Quit
End If
End Sub
 
Is this just the way it is?

If you dont understand what I am trying to fix, you can look at the very end of my video here. At the very end, when I click log out, you can see the Access window.
 

Users who are viewing this thread

Back
Top Bottom