PDA

View Full Version : SOLVED: Disable Restore Window Button



eed
07-14-2004, 08:17 AM
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!!

ALaRiva
07-14-2004, 01:30 PM
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.

SJ McAbney
07-14-2004, 04:04 PM
Just set your forms' Modal property to Yes.

SJ McAbney
07-14-2004, 04:09 PM
Or, in a module, declare a Public boolean.

Public booCloseAccess As Boolean

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:

Private Sub Form_Unload(Cancel As Integer)
If Not booCloseAccess Then Cancel = True
End Sub

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

booCloseAccess = True
DoCmd.Quit



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 (http://www.mvps.org/access/general/gen0005.htm).

SJ McAbney
07-15-2004, 01:49 AM
I've attached an A97 and A2000 example demonstrating the method described above. :)

eed
07-15-2004, 07:07 AM
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!!