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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable 'X' in User Form 1

Status
Not open for further replies.

nickjar2

Programmer
Jun 20, 2001
778
US
Is there anyway I can disable the user forms 'X' button. If not, is there an event such as On_Close(). I can't seem to be able to work this one out.
I am using the user form as a logon form. The user can close this form to continue but if they do, the various buttons in the spreadsheet will not be enabled. So if they log on correctly (logging on to Business Objects) users can then proceed to use the buttons, but if they click Cancel (a button I have created) or click the 'X', they won't be able to use the buttons.

Cheers,

Nick
 
Hi Nick!

You didn't say what application you are working in. In Access, the form has a property called Close Button which you can set to no.

hth
Jeff Bridgham
 

The following is copied directly from the example in the Help File (for QueryClose)

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
'Prevent user from closing with the Close box in the title bar.
If CloseMode <> 1 Then Cancel = 1
UserForm1.Caption = &quot;The Close box won't work! Click me!&quot;
End Sub

Hope this helps.
 
Cheers.
I tried this but the code didn't get executed when i tried to the close the form. The form just closed.

Nick
 
Duhh! I was doing it wrong. That is exactly what I needed.

Cheers Donna6197,

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top