Solved

Blocking CTRL-F4

Posted on 2004-09-23
5
204 Views
Last Modified: 2006-11-17

Hello Smart Folk,

Anyone got a code snippet that will stop my users being able to close a form with CTRL-F4?

Thanks,

M
0
Comment
Question by:Moother
  • 3
  • 2
5 Comments
 
LVL 18

Accepted Solution

by:
Data-Man earned 33 total points
ID: 12132827
use the keydown event at the form level to check for the that cobination and then set the keycode to 0

Mike
0
 
LVL 3

Author Comment

by:Moother
ID: 12133782
any idea how to do that so my pc will understand it?

I know the principle..., but lack the talent...
0
 
LVL 18

Expert Comment

by:Data-Man
ID: 12133927
Put this code inside the keydown event for the form.

Also set the key preview property to yes.


If (Shift And acCtrlMask) > 0 And KeyCode = vbKeyF4 Then
    KeyCode = 0
End If

Mike
0
 
LVL 3

Author Comment

by:Moother
ID: 12134375
worth a A grade!!!

thanks a million!
0
 
LVL 18

Expert Comment

by:Data-Man
ID: 12134392
too bad it wasn't worth a million....LOL...Mike
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now