ctrl alt del, prevent from closing form

laurat

Registered User.
Local time
Today, 08:03
Joined
Mar 21, 2002
Messages
120
I have placed code on the Unload event of a form to check if certain fields have data in them (once the user has started entering in data), if not the form will not close. However, I have realized that ctrl alt del, allows them to close the form with only half the data in it. This is causing holes in the table, records with only half the info. Is there any way I can prevent ctrl alt del from closing the database?

Thanks in advance.
Laura
 
You need to bonk your users on the head for using Ctrl + Alt + Delete for that Windows command is a database killer. It is too easy to corrupt a database if it is not closed properly.

You do not want to disable the Ctrl + Alt + Delete just incase they really need to do it (as a last resort). I suggest that you disable one of those keys (Delete key) in your db using the AutoKeys macro. Search the help files for Autokeys Macro. You can not disable the Alt key.

HTH
 
still a bit confused

Well I found some topics on this site about Autokeys. And this is what I have so far, I created a new macro and named it Autokeys. I clicked the macro name button on the toolbar which created another column called "Macro Name". In that column I typed {DELETE} and under the "Action" column I chose the CancelEvent action. Is this all I have to do? What makes the macro run? I must have done something wrong because Ctrl + Alt+ Del still closes the form. Please help!!
 
That is one of two macros that run when the db is first opened. You can not manually run the macro (you can but it does not do anything). AutoExec is the other macro that runs when the db is first opened.

If your AutoKeys macro is correctly set up, the next time you open the db, the Delete key should not work (no matter where you are in the db). I usually set the "Action" do display a message box stating that the "Detete" key has been disabled.

HTH
 
Forget what I just said. Disabling the Delete key does not prevent the combination Ctrl + Alt + Delete. Windows will not allow that. After searching some VB sites, it is possible but the warnings are firm that you could prevent a computer from "ever again" logging into a network!!!

I think that you need to reevaluate why you need to disable Ctrl + Alt + Delete. Educate your users that key combo can corrupt your db.

Search this forum for I know I have seen other posts for keeping a form from closing unless "something" is done.

Good Luck!
 
The problem is with where you have placed your editing code. Using the unload event of the form is akin to closing the barn door after the horses are out. The record has already been saved in its incorrect state prior to the execution of the unload event.

Move the edits to the BeforeUpdate event of the form and if any of the edits fail, cancel the update. This will prevent the record from being saved no matter how the form is closed.

If IsNull(SomeField) Then
Cancel = True
Me.SomeField.SetFocus
MsgBox "Some error, record will not be saved",vbOKOnly
End If
 
While that does make sense, it is not an option because of the way the database is set up (it is done wrong and I know that now). I have used an autonumber field, so once info is placed into one field that record is begun in the table and the number is assigned. That is why once a user starts entering data they need to complete the entire form before closing.
 
ONE MORE QUESTION!!

Since I cannot prevent CTRL ALT DEL from closing a form is there a way I can display a message box before it closes that says it is going to close and the record will only be partially filled in?
 
Did you not try Myke's suggestion @
http://www.utteraccess.com/forums/s...=125671&page=2&view=collapsed&sb=5&o=&fpart=1

I would be more worried as to why your users are using Ctrl Alt Delete? They are risking the corruption of your database. Ctrl Alt Delete is not only closing the form it is closing the database when they choose to End Task your database.

You should place a message (box or label) when the form opens and warn the users that their record will not be saved if they do not use your custom save button. Also warn them that they are risking the corruption of the database if they use Ctrl Alt Delete to shut the database down.

Have you asked your users why they are using Ctrl Alt Delete to shut the database down?
 
Well the database has been set up and in use for aobut 6 months now and unfortunately the way I set it up, the primary key is an autonumber so whenever data is entered a record is generated so a save button would not work because even if they don't save it and close the form the number was already generated.

I am not sure why users have used ctrl alt del, So many people use the database we are not sure who has done it.
 

Users who are viewing this thread

Back
Top Bottom