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 ctrl-pause/break 1

Status
Not open for further replies.

merlynsdad

Programmer
Nov 18, 2010
175
US
I have a password on the Admin section of a db. If the password box has focus, and the user presses ctrl-pause/break, the user can bypass the password and get into the db. I'd like to disable ctrl-pause/break in vba to prevent this. How do I do this?

If the square peg won't fit in the round hole, sand off the corners.
 
How are ya merlynsdad . . .

In the reference given by [blue]MazeWorX[/blue] change 189 to [blue]vbKeyPause[/blue].

Your Thoughts ...

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Initial thought is, it didn't work. But I might have put the code in the wrong place. There's a frmMain with a button for Admin, which brings up a generic password box, and when the correct pw is entered, brings up frmAdmin. Following your referenced post, I put the code on frmMain, but I can still break in when the pw box is up. Should it be on the Admin control button instead, since that's where the pw box code resides?

If the square peg won't fit in the round hole, sand off the corners.
 
I think I solved the problem. My revised code (incl the KeyCode line) is
Code:
strPW = "password"
            strInput = InputBox("Enter Administrator password")
            If (Shift = acCtrlMask) And (KeyCode = vbKeyPause) Then strPW = ""
            If strInput = strPW Then
                DoCmd.OpenForm "frmAdmin"
                DoCmd.Close acForm, "frmMain"
            Else
                MsgBox ("You have entered an incorrect password.")
            End If
Now an attempted breakout is treated the same as a wrong password.

If the square peg won't fit in the round hole, sand off the corners.
 
Oops...still doesn't work. Still accepting suggestions.

If the square peg won't fit in the round hole, sand off the corners.
 
merlynsdad . . .

Can't intercept keystrokes to an [blue]Inputbox[/blue]! An added textbox on [blue]frmMain[/blue] to go with your [blue]Admin[/blue] button should do the trick ...

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top