PC Review


Reply
Thread Tools Rate Thread

Close X button on Usser Form

 
 
Scardona Bay Viktor
Guest
Posts: n/a
 
      14th Mar 2008
Hi Gentleman.

I have a form that has the blue title bar along with the "X" in the upper
right corner.

I am having trouble finding the code or process of eliminating the "X" so
the user will have only once choice to close the form through the Close
button created in the form.

Any suggestions would be highly appriciated to get be through this hurdle.

Thanks!
--
SBR
 
Reply With Quote
 
 
 
 
Jon Peltier
Guest
Posts: n/a
 
      14th Mar 2008
Here's a better way. The user wants to close the form, so let them close the
form using either the close button or the big X in the corner. When they
click the X, you simply want to cancel the normal behavior of the X and run
the close button code.

Put this procedure into your userform code module:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
' how was the form closed? vbFormControlMenu = X in corner of title bar
If CloseMode = vbFormControlMenu Then
' cancel normal X button behavior
Cancel = True
' run code for click of Close/Cancel button
btnCancel_Click
End If
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______



"Scardona Bay Viktor" <(E-Mail Removed)> wrote in
message news:46C050B8-C673-43D3-87A6-(E-Mail Removed)...
> Hi Gentleman.
>
> I have a form that has the blue title bar along with the "X" in the upper
> right corner.
>
> I am having trouble finding the code or process of eliminating the "X" so
> the user will have only once choice to close the form through the Close
> button created in the form.
>
> Any suggestions would be highly appriciated to get be through this hurdle.
>
> Thanks!
> --
> SBR



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
button to open form export to Excel and close form deb Microsoft Access Forms 1 25th Jun 2008 02:27 PM
Have to click "Close" button three times to close dialog form Michael Fuchs Microsoft Access Form Coding 0 6th Aug 2006 11:37 AM
Close button on a form will not close form - error 2585 - action cannot be carried out while processing a form Angus Comber Microsoft Access 2 19th Jul 2006 12:21 PM
Command Button Open form / Close form =?Utf-8?B?cGRiZXJnZXI=?= Microsoft Access Forms 1 15th Feb 2006 06:21 PM
Button To open new form does not close the main form Veli Izzet Microsoft Access 7 25th Jul 2005 01:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:38 PM.