Because this was brought up in my previous post here is the solution to disable the user from using the shift key to access the database window during startup.
1. Create a new module and past this code inside it:
Then save the module to whatever you like.
2. Create the macros.
2.1 Macro Name: ByPassKeyOff
Action: Runcode
Function: BypassKey(False)
2.2 Macro Name: ByPassKeyOn
Action: Runcode
Function: BypassKey(True)
3. On your switchboard or logon screen create a rectangle with the same backcolor as the form and no border. Remember where it is. Or if you have a picture you can use it aswell. On the properties of the rectangle or picture select the Event tab->OnClick. Use the picker to select the ByPassKeyOn macro.
4. Run the ByPassKeyOff macro. Save and close the db.
5 Now when you start up and hold the shift key the db window will not show. To allow the shift key click where you put your rectangle or click the picture and close the db. Re-open with the shift key and the database window will appear. To disable do step 4.
There you go. Just another way to make sure your database is secure.
cheers from MadMaxx
1. Create a new module and past this code inside it:
Code:
'---------------------------------------------------------------------'
' Module: DisableShiftKey '
' Date: July 18, 2003 '
' '
' Purpose: To stop the user from holding the shift key on startup to '
' access the database window. '
'---------------------------------------------------------------------'
Option Compare Database
Option Explicit
'----------------------------------------------------------------------
Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True
Change_Bye:
Exit Function
Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function
'----------------------------------------------------------------------
Function BypassKey(onoff As Boolean)
Const DB_Boolean As Long = 1
ChangeProperty "AllowBypassKey", DB_Boolean, onoff
End Function
'-----------------------------------------------------------------------
Then save the module to whatever you like.
2. Create the macros.
2.1 Macro Name: ByPassKeyOff
Action: Runcode
Function: BypassKey(False)
2.2 Macro Name: ByPassKeyOn
Action: Runcode
Function: BypassKey(True)
3. On your switchboard or logon screen create a rectangle with the same backcolor as the form and no border. Remember where it is. Or if you have a picture you can use it aswell. On the properties of the rectangle or picture select the Event tab->OnClick. Use the picker to select the ByPassKeyOn macro.
4. Run the ByPassKeyOff macro. Save and close the db.
5 Now when you start up and hold the shift key the db window will not show. To allow the shift key click where you put your rectangle or click the picture and close the db. Re-open with the shift key and the database window will appear. To disable do step 4.
There you go. Just another way to make sure your database is secure.
cheers from MadMaxx