Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding Access Close Button

Status
Not open for further replies.

EvilTwinOfAtrus

Technical User
Dec 30, 2002
56
GB
Hi

I know how to hide the close buttons on Access forms but I also need to disable the main 'X' close button in the top right of the Access window so that users are forced to use the proper buttons in the forms to exit the database. How is this done? I am using Access 97.

Thankyou in advance

-EToA
 
Hi!

There are ways of hiding the close button, but that seldom prevents the users from hitting ALT+F4, CTRL+F4, CTRL+W to exit the application or form.

If the issue is to have a controlled closing of forms or database, take a look at mstrmage1768's faq faq702-1870.

If you still wish to pursue the 'x' button thingie, there are a lot of code floating in these fora (try a keyword search), for instance thread702-831433 (I don't know whether this code works in 97, though)

Roy-Vidar
 
Hi,

if you want to prevent the user from closing, using the 'X' add a Global var , i.e. Global fOkToClose as booleanthen on your form unload event...
Code:
Private Sub Form_Unload(Cancel As Integer)
    If Not OKToClose Then
        MsgBox "Please use the 'Exit' button on the main form" _
            & vbCrLf & vbCrLf & "(the one with 'EXIT' written in big red letters)", vbCritical, "Exit Error"
        Cancel = Not OKToClose
    End If
End Sub
and on your exit button (the one with 'EXIT' written in big red letters) add fOkToClose = true at the beginning...

HTH, Jamie
FAQ219-2884
[deejay]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top