473,378 Members | 1,688 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Disable Close Button as Dirty_Form event

2
Hi again,

I'm new to VBA and would really appreciate your help.

I have disabled the "X" close button and created a Close button, which I want to disable as a Form_Dirty event. So that users can only Close the form if they haven't made changes or have Saved their changes.

However, as soon as I dirty the form, I get an error message pointing at this code:

Expand|Select|Wrap|Line Numbers
  1.  Private Sub Form_Dirty(Cancel As Integer)
  2. cmdClose.Enabled = False
  3. End Sub 
I really don't understand why I can't do this, probably simple, thing. Any help would be much apppreciated.

Thanks,

Kirsty
Apr 15 '07 #1
1 3199
ADezii
8,834 Expert 8TB
Hi again,

I'm new to VBA and would really appreciate your help.

I have disabled the "X" close button and created a Close button, which I want to disable as a Form_Dirty event. So that users can only Close the form if they haven't made changes or have Saved their changes.

However, as soon as I dirty the form, I get an error message pointing at this code:

Expand|Select|Wrap|Line Numbers
  1.  Private Sub Form_Dirty(Cancel As Integer)
  2. cmdClose.Enabled = False
  3. End Sub 
I really don't understand why I can't do this, probably simple, thing. Any help would be much apppreciated.

Thanks,

Kirsty
I see no reason why you can't do this also. What exactly is the Error Message?
Apr 16 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Suni | last post by:
Hi everybody, But what I am trying to do is like, there are 2 forms, and if I click on the button in form1, it'll open up form2 and disable the button in form1. Then when I click on the button in...
1
by: NuBBeR | last post by:
Either I need to know how to disable the close button ("x") or handle the close event on the main form.
2
by: Mike Nooney | last post by:
How do I disable the "X" in the upper right hand corner of my Web Page. This is not for a windows form, but rather a web application. What I really need is to stop the user from unloading the...
3
by: Paul | last post by:
Hi, just wondering if there is a way to disable the back button of the browser as I have a logoff page and would like to not allow the back operation? Guessing there may be a way to do it through...
7
by: Wayne | last post by:
I have found the following code on this newsgroup that removes the Access Application minimize, restore and close buttons. Private Const GWL_EXSTYLE = (-20) Private Const GWL_STYLE = (-16) ...
0
by: JP | last post by:
Is there a way to temporirly disable the X button (close) on a MODAL window in the web browser? We have cleanup code that needs to run after the user closes the modal window. This works fine if the...
2
by: PamelaDV | last post by:
I am wondering if there is a way to disable the "X" used to close the Access application window? I know how to disable it for individual forms, but I would like to disable it for the application...
3
by: Richard Lewis Haggard | last post by:
Is there an easy way to disable the hotkey sequence Control F4 or otherwise prevent the action from killing off MDI child windows in VS05/WinForms 2? I've already figured out how to get rid of the...
8
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I disable the right mouse button? -----------------------------------------------------------------------...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.