Asked By
Aynne W.
0 points
N/A
Posted on - 08/25/2011
I created a simple program from MS Access 2003.
I linked all necessary tables from our database to our Existing ERP system. The database is open to anyone who knows how to use shift – enter which can be used to open tables queries on a design mode and override the startup option.
We don't want that to happen. Image below shows that I already deselected any options on a startup.
Am I missing something?
What do I need to do?
How to lock my MS Access from Shift – Enter
First of all, you may put a database password to ensure security on unauthorized use of your program.
Second is to solve your problem on disabling the shift key to disallow key passage before the start up properties you need to do the following:
1. Create a module and paste this code:
Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As Database, prp As Property
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
 Set prp = dbs.CreateProperty(strPropName, _
        varPropType, varPropValue)
 dbs.Properties.Append prp
 Resume Next
 Else
  ChangeProperty = False
 Resume Change_Bye
 End If
End Function
2. Save the module.
3. It is up to you how you will choose to make the function execute. But my advice is to create command buttons for enabling or disabling the function. Make the command buttons not visible to the users but only to you by assigning a password to any textbox you desire to choose to make it visible and invisible.
4. Name the 1st command button "enable" and the 2nd command button "disable".
5. Then write this code for enable on 1st command button:
Private Sub Command1_Click()
 Const DB_Boolean As Long = 1
 ChangeProperty "AllowBypassKey", DB_Boolean, True
End Sub
6. Write this code for disable on 2nd command button:
Private Sub Command2_Click()
 Const DB_Boolean As Long = 1
 ChangeProperty "AllowBypassKey", DB_Boolean, False
End Sub
After all these procedures, when you execute the program and click the "disable" command button it will disable the "shift" + "enter" and eventually lead any users to your start up properties. In that case it will not override the start up options anymore. By clicking enable button you can edit again your program by your own choice of updates.
You may opt to do all of these in a separate test program so that when you are ready to write in your operational program, it will be perfectly executed.
I hope this solves your problem.