Hi JC:
Here is what you need to do.
Step I:
Create a backup copy just in case things do not work out.
Step II:
Click on Module and copy the following code right under OPTION COMPARE DATABASE
Function SetStartupProperties() As Integer
Const DB_Boolean As Long = 1
ChangeProperty "StartupShowDBWindow", DB_Boolean, False
ChangeProperty "StartupShowStatusBar", DB_Boolean, False
ChangeProperty "AllowBuiltinToolbars", DB_Boolean, False
ChangeProperty "AllowFullMenus", DB_Boolean, False
ChangeProperty "AllowToolbarChanges", DB_Boolean, False
ChangeProperty "AllowShortcutMenus", DB_Boolean, False
ChangeProperty "AllowBreakIntoCode", DB_Boolean, False
ChangeProperty "AllowSpecialKeys", DB_Boolean, False
ChangeProperty "AllowBypassKey", DB_Boolean, False
End Function
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
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
End If
End Function
Save the module as ModStartUp
Step III:
From Tools > Database Utilities > Make MDE File
(You can use the same file name)
This will restrict users opeining the forms in design mode. Therefore, the users can not see and change your codes.
Step IV:
Close all the files
Step V:
Open the newly created file YourNewDatabase.mde (note the extension)
Step VI:
Open a new Macro
Type in RunCode in the first line under Action
and in the FUNCTION NAME type in
SetStartUpProperties ()
Save the Marco as AutoExec
Step VII:
From Tools > StartUp
Uncheck Display Database Window (so the database window will not be visible to the user)
Step VIII
From Tools > Options > General
Check Compact on Close (so the database compacts and reduce its size before closing).
Step IX:
Open and close the database a couple of times for the codes to work. Once the code starts working all you will see is the switchboard.
Note:
Step III thru Step IX should be done only on the newly created .mde file (Rule of thumb - always create a back up mdb file before creating a mde file because even you are restricted from viewing and changing the codes)
Step II is done so that the user does not open the db by using shift+enter to view the database window.
GOOD LUCK AND HOPE THIS HELPS.