Consulting

Results 1 to 6 of 6

Thread: SOLVED: Disable Restore Window Button

  1. #1
    VBAX Contributor
    Joined
    Jun 2004
    Location
    Texas
    Posts
    139
    Location

    SOLVED: Disable Restore Window Button

    I'm full of questions lately. Today's question: Is it possible to disable the Restore Window button on a form?

    Basically, I don't want users to ever be able to access anything but the current form. I've got the Taskbar object buttons turned off; I've hidden the Database window; I've disabled the Window menu so that they can't click to the names of other open forms; and I'm working on removing the "sizing" buttons on the forms themselves. I can take away the MinMaxClose buttons, but the Restore will still be there.

    I already tried giving the form a dialog border and resizing it in Design view (rather than maximizing it in Design view). This does prevent the Restore button from appearing, but I can't make the form look "normal" (ie, I can't size it so that it fills the Access window and looks like a regularly maximized form sans Restore button).

    Does anyone know how to actually eliminate the Restore Window button, or else does anyone know a good way to just prevent your users from getting the current form out of the way? Thanks in advance for all ideas!!
    With program specs this fickle, you've just got to believe in Discord.

  2. #2
    VBAX Regular
    Joined
    Jul 2004
    Location
    San Bernardino, California
    Posts
    69
    Location
    Hmmm . . . I'm not sure exactly what you are talking about.

    Look at the Properties of the Form in Design View and look for a Property called 'ControlBox'. Set that to 'NO' and see if that's the effect you are looking for.

    HTH, Thanks.

  3. #3
    VBAX Tutor SJ McAbney's Avatar
    Joined
    May 2004
    Location
    Glasgow
    Posts
    243
    Location
    Just set your forms' Modal property to Yes.

  4. #4
    VBAX Tutor SJ McAbney's Avatar
    Joined
    May 2004
    Location
    Glasgow
    Posts
    243
    Location
    Or, in a module, declare a Public boolean.

    [vba]Public booCloseAccess As Boolean[/vba]

    Access works on a first opened, last closed basis so the first form you open will be the last one Access closes. Have a new form, called frmHidden, and ensure this is the first one you open. Make sure it is opened and hidden.

    In it's Unload event, put:

    [vba]Private Sub Form_Unload(Cancel As Integer)
    If Not booCloseAccess Then Cancel = True
    End Sub[/vba]

    On your switchboard you'll have a quit button. On this button's click event put:

    [vba]booCloseAccess = True
    DoCmd.Quit[/vba]



    A situation arose from my solution posted here. It was claimed that I'd stolen it from Dev Asish's The Access Web. Personally, I wasn't aware that the solution was there as it was a trick shown to me by an old colleague. Since it's possible that my old colleague could have obtained this solution from Dev Ashish's The Access Web I'm providing a link to his site.

  5. #5
    VBAX Tutor SJ McAbney's Avatar
    Joined
    May 2004
    Location
    Glasgow
    Posts
    243
    Location
    I've attached an A97 and A2000 example demonstrating the method described above.

  6. #6
    VBAX Contributor
    Joined
    Jun 2004
    Location
    Texas
    Posts
    139
    Location
    Thank you everyone for your ideas! Abulafia, the Modal property basically achieved my goal.

    Even without the button to fully Minimize the form, if you hit Restore on a previously Maximized form, it becomes somewhat smaller than the total Access window, and you can then click to other now-also-smaller forms that may have been behind the current form. I wanted to prevent people from clicking back to an earlier-opened form while leaving the later-opened form open.

    With Modal turned on for all forms, you can still hit Restore and see all the forms as smaller windows inside the Access window. BUT, you can't actually move the focus off the current form unless you hit close. It's a little sloppier than I'd like, but it very much achieves the goal.

    I found some code in the Access 2000 Developer's Handbook that was supposed to save the name of the opening form in the tag of the opened form so that it could hide the opening form until the opened form was closed. I couldn't get this code to work.

    I'd also like to add that *****'s code worked amazingly well -- it results in the current form window acting as the entire application window, so if you hit Restore or Minimize, it performs those functions for the entire Access application, and you can't ever get to a previous form without closing the current form. Thank you, ******, I will probably stash this away in my bag of tricks for a future use!!! In this case, however, I'm going to use the Modal solution, because the users of this application do need the menus and toolbars sometimes.

    Thanks again, everyone, this is totally resolved now!!
    With program specs this fickle, you've just got to believe in Discord.

Posting Permissions

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