Attached is a log-on example that creates user-levels identified as Cases is VBA. Pasted below is the code for a module that will enable/disable the shift-function on opening the db.
Maybe between the two you can come up w/ something. I don't have anything about this for a specific form, though.
This is the code from a module called PublicModule:
-----------------------------------------
Public Function SetProperties(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
On Error GoTo Err_SetProperties
Dim db As DAO.Database, prp As DAO.Property
Set db = CurrentDb
db.Properties(strPropName) = varPropValue
SetProperties = True
Set db = Nothing
Exit_SetProperties:
Exit Function
Err_SetProperties:
If Err = 3270 Then 'Property not found
Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
db.Properties.Append prp
Resume Next
Else
SetProperties = False
MsgBox "SetProperties", Err.Number, Err.Description
Resume Exit_SetProperties
End If
End Function
----------------------------------------------------
There is also code attached to a button/function on a form, etc. pasted below:
--------------------------------------
Dim strInput As String
Dim strMsg As String
Beep
strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & _
"Enter the programmer's password to enable the Bypass Key."
strInput = InputBox(Prompt:=strMsg, title:="Disable Bypass Key Password")
If strInput = "VtX1300#1" Then
SetProperties "AllowBypassKey", dbBoolean, True
Beep
MsgBox "The Bypass Key has been enabled." & vbCrLf & vbLf & _
"The Shift key will allow the users to bypass the startup options the next time the database is opened.", _
vbInformation, "Set Startup Properties"
Else
Beep
SetProperties "AllowBypassKey", dbBoolean, False
MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & _
"The Bypass Key was disabled." & vbCrLf & vbLf & _
"The Shift key will NOT allow the users to bypass the startup options the next time the database is opened.", _
vbCritical, "Invalid Password"
Exit Sub
End If
Exit_DisableShiftKeyButton_Click:
Exit Sub
Err_DisableShiftKeyButton_Click:
MsgBox "DisableShiftKeyButton_Click", Err.Number, Err.Description
Resume Exit_DisableShiftKeyButton_Click
-------------------------------------
The bold text is the password. Change it to what you want.
You'll need both the module and the code for the button for this to work. When you run this function, it doesn't actually take place until the next time you log-on.
I know this isn't exactly what you're looking for, but hopefully it'll help.