Results 1 to 12 of 12
  1. #1
    New Lounger
    Join Date
    Jun 2002
    Location
    Chicagoland, IL USA
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    97--Eliminating 'Minimize/Maximize/Exit' buttons (Access 97 sr-2)

    All,

    I took an access class and the instructor told me there is a way to eliminate these buttons from the upper right-hand corner. I found information once upon a time here for Access 2000, but this database is in Access 97. Does anyone have any information on how to get rid of these when opening the database so the user MUST leave through the "Exit the system" button? Thanks in advance.

    Debra

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: 97--Eliminating 'Minimize/Maximize/Exit' buttons (Access 97 sr-2)

    (1) You can set the Control Box property of a form to False. This will hide the buttons on a form unless it is maximized
    (2) You can use a variable to control when a user can close a form or Access: see here on the Access Web.
    (3) You can use Windows API calls to remove the buttons completely: see here, also on the Access web.

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: 97--Eliminating 'Minimize/Maximize/Exit' buttons (Access 97 sr-2)

    There's still another couple of ways:

    1) open the form as a dialog (i.e., popup and modal) and set the Control Button property to false and the Close Button property to No,
    2) or set the border style property of a non-popup, non-modal form to dialog and set the Control Box and Close Button properties to No.
    Charlotte

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: 97--Eliminating 'Minimize/Maximize/Exit' buttons (Access 97 sr-2)

    I too am interested in this because I maximise about 90% of my forms to stop users clicking outside the form they are using and then hiding it. ( I constantly see people get confused when this happens.)

    I have tried using the API suggestion that Hans put up, and it just didn't work for me. I have used it by putting a function call in the activate event of the form. Its behaviour was inconsistent - sometimes it just gave me a normal maximised form (with a close button) , other times a large form with no close button, but not quite maximised. Do those API functions require a particular version of windows? (I use 98)

    Charlotte's first suggestion stopped the form maximising, while the second didn't remove the close button when the form was maximised. Is that what supposed to happen?
    Regards
    John



  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: 97--Eliminating 'Minimize/Maximize/Exit' buttons (Access 97 sr-2)

    John,

    I don't like the API method very much. I also got inconsistent results; users were complaining that the supposedly "maximized" window didn't fit into the Access window, or was shifted, ...

    Even a borderless form will have a Restore and Close button when maximized; there is nothing to be done about that AFAIK (except for the API workaround).

    For this reason, I stopped trying to maximize my forms.

    If I want to prevent the user from closing a form except by using a command button (or menu item or toolbar button), I use a boolean variable that is False by default. Only when the user clicks the command button, the variable is set to True. In the OnUnload event of the form, I cancel the closing of the form if the variable is False.

    If I want to prevent the user from clicking in another form, I set the Modal property of the form to Yes.

    I have attached a zipped Access 97 database that illustrates this.
    Attached Files Attached Files

  6. #6
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: 97--Eliminating 'Minimize/Maximize/Exit' buttons (Access 97 sr-2)

    Hi Hans

    Help says

    You can use the Modal property to specify whether a form opens as a modal form. When a form opens as a modal form, you must close the form before you can move the focus to another object.

    What does this mean?

    John

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: 97--Eliminating 'Minimize/Maximize/Exit' buttons (Access 97 sr-2)

    Hello John,

    Ordinarily, you can switch from one open window within Access to another by clicking in the other window, or by typing Ctrl+F6.

    If you set the Modal property of a form to Yes, you can't switch to other windows within Access - if you try to click in another window, you just get a beep. You must close the modal window before you can activate another window. You can still use the menus and toolbars, unless you also set the Popup property to Yes.

    Why would you make a form modal?

    Sometimes, users get confused if they accidentally click in another window. This can cause the window they were working in to be hidden (partially or entirely). You can prevent them from doing this by setting Modal to Yes.

    Also, there may be situations where you want to prevent users from doing other things in the database until they have finished entering data in the currently active form. Again, setting Modal to Yes ensures that the user must close the window before activating another. You can perform validity checks etc. when the window is closed.

    Note: if you open a form using DoCmd.OpenForm with the WindowMode argument set to acDialog, like

    DoCmd.OpenForm "frmMyForm",,,,,acDialog

    the effect is as if you had set Modal to Yes, Popup to Yes and BorderStyle to Dialog, regardless of the options you set in design mode.

    Regards,
    Hans

  8. #8
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: 97--Eliminating 'Minimize/Maximize/Exit' buttons (Access 97 sr-2)

    I just want to clarify my previous post a bit re the API method.
    This method doesn't try to eliminate the close button from maximized form, instead it restores a maximised form, then sets the size of this to be as large as possible. So visually, you don't get a maximised form.

    Secondly, I my experiments, I was switching between form view and design view. In design view, the forms design toolbar, and the toolbox would appear on the screen at top and left respectively. When the code that worked out how big to make the window executes, these toolbars were still on the screen, so the window was sized to fit around them. However, when the window was actually displayed the toolbars had gone, so the window did not completely fill the screen.
    Regards
    John



  9. #9
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: 97--Eliminating 'Minimize/Maximize/Exit' buttons (Access 97 sr-2)

    Hi Hans

    Thanks for the modal clinic, I will be spending some of my weekend experimenting and possibly retooling some of my forms, all part of my utopia user interface

    Thanks, John

  10. #10
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: 97--Eliminating 'Minimize/Maximize/Exit' buttons (Access 97 sr-2)

    Hi,
    Do you mean that you want to disable the close button on the application window or on a form window? If it's the application window, then the following function works under Access2002 on WinXP (it may need tweaking for Access 97 and/or your OS):
    <pre>Option Compare Database
    Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, _
    ByVal bRevert As Long) As Long
    Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
    Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, _
    ByVal nPosition As Long, ByVal wFlags As Long) As Long
    Const MF_BYPOSITION = &H400&
    Const MF_REMOVE = &H1000&
    Public Function RemoveClose()
    Dim hSysMenu As Long, nCnt As Long
    hSysMenu = GetSystemMenu(Access.Application.hWndAccessApp, False)
    If hSysMenu Then
    ' Get System menu's menu count
    nCnt = GetMenuItemCount(hSysMenu)
    If nCnt Then
    ' Menu count is based on 0 (0, 1, 2, 3...)
    RemoveMenu hSysMenu, nCnt - 1, MF_BYPOSITION Or MF_REMOVE
    RemoveMenu hSysMenu, nCnt - 2, MF_BYPOSITION Or MF_REMOVE
    DrawMenuBar hSysMenu
    Application.RefreshTitleBar
    End If
    End If
    End Function
    </pre>

    There may well be easier ways (!) but I hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  11. #11
    New Lounger
    Join Date
    Jun 2002
    Location
    Chicagoland, IL USA
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: 97--Eliminating 'Minimize/Maximize/Exit' buttons (Access 97 sr-2)

    I know I'm a rookie, so forgive me on that point.... I don't know what "modal" is. But maybe I can better explain things.

    Firstly, I did what was first suggested and all that disappeared was the minimize button. The X didn't go away, which is what I *really* want gone.

    We have a database that opens up other databases and tables. There are times when the user will click on the X when they've finished instead of the "Exit the Database" button. I was told in an Access class that this *could* corrupt data (and we've had TONS of corruption issues).

    When the shortcut is executed on the desktop, it brings up a form. It does take up the whole screen; however, as stated, the minimize/maximize/close buttons are still present.

    We are still on Windows 95A (can you believe that?!) and Access 97, if that helps anyone.

    I have another question, but I'll post it in its own thread.

    Thanks again,
    Debra

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: 97--Eliminating 'Minimize/Maximize/Exit' buttons (Access 97 sr-2)

    Hi Debra,

    I had this problem of database corruption in a multi-user environment in Access 97. As far as I have been able to trace it, it happened as follows:
    1. <LI>User A and user B both open the same form.
      <LI>User A sets a filter (or changes the sort order, or ...).
      <LI>User A closes the form. Access sees the filter (or sort order or whatever) as a change in the design of the form. It tries so save the form (without asking for confirmation). But since user B also has the form open, there is a conflict. Apparently, Access can't resolve this gracefully.
    This problem doesn't occur if you make the database into an .mde database, or if you apply database security, so that standard users can't modify the design of forms. (There are other forms of corruption of course. Memo fields seem to be prone to corruption, and Access 97 is extremely sensitive to network problems)

    If .mde or database security are not an option, you might try the following:
    <UL><LI>Set the border style of forms to Dialog, so that they can't be maximized.
    <LI>Try to prevent users from inadvertently saving a form, by not showing the standard menus and toolbars.
    <LI>Prevent users from closing a form except by using a "Close" command button. I use a Boolean variable for this (as in the example I attached to a previous reply).
    <LI>Close forms in code without saving them:
    DoCmd.Close acForm, Me.Name, acSaveNo[/list]I have used this in a few databases where .mde or database security were not possible (for reasons I won't go into here). This has eliminated the corruption problem almost completely <img src=/S/crossfingers.gif border=0 alt=crossfingers width=17 height=16>.

    Although there are ways to disable the close button in the upper right corner of the Access application window, this doesn't disable Alt+F4 as a shortcut to exit the application. So, where needed, I prefer the methods described above.

    HTH,
    Hans

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •