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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

question on securing database

Status
Not open for further replies.

dpimental

Programmer
Jul 23, 2002
535
US
All, I am trying to put some finishing touches on a database. I want to be able to disable the shift key as well as keep people from importing my tables from the front end database?

How do I do these things?

David Pimental
(US, Oh)
 
Following code assumes a complete user interface of forms only and a start up form named as StartUp

Code:
Public Sub Initiation()
'Create properties first
Dim prp As Object

    With CurrentDb
        Set prp = .CreateProperty("AppTitle", 10, "Initiation Of All Properties", True)
        .Properties.Append prp
        Set prp = .CreateProperty("StartupForm", 10, "StartUp", True)
        .Properties.Append prp
        Set prp = .CreateProperty("AllowBypassKey", 1, True, True)
        .Properties.Append prp
        Set prp = .CreateProperty("AllowBreakIntoCode", 1, True, True)
        .Properties.Append prp
        .Properties("AllowFullMenus") = True
        .Properties("AllowShortcutMenus") = True
        .Properties("StartupShowDBWindow") = True
        .Properties("StartupShowStatusBar") = True
        .Properties("AllowBuiltInToolbars") = True
        .Properties("AllowToolbarChanges") = True
        .Properties("AllowSpecialKeys") = True
        Application.RefreshTitleBar
    End With
    Set prp = Nothing

End Sub

Code:
Public Sub EnforceDbProperties()
Dim prp As Object
'Reverse properties here
    If Application.CurrentUser = [b]"YourUserAccount"[/b] Then
        With CurrentDb
            If .Properties("AllowByPassKey") = True Then
                .Properties("AppTitle") =  [b]"YourShinyApplicationTitle"[/b] 
                Set prp = .CreateProperty("StartupForm", 10, "StartUp", True)
                .Properties.Append prp
                .Properties("AllowFullMenus") = False
                .Properties("AllowShortcutMenus") = True
                .Properties("StartupShowDBWindow") = False
                .Properties("StartupShowStatusBar") = True
                .Properties("AllowBuiltInToolbars") = True
                .Properties("AllowToolbarChanges") = False
                .Properties("AllowSpecialKeys") = False
                .Properties("AllowBypassKey") = False
                .Properties("AllowBreakIntoCode") = True
            Else
                .Properties("AppTitle") = "Hello Master"
                .Properties.Delete "StartUpForm"
                .Properties("AllowFullMenus") = True
                .Properties("AllowShortcutMenus") = True
                .Properties("StartupShowDBWindow") = True
                .Properties("StartupShowStatusBar") = True
                .Properties("AllowBuiltInToolbars") = True
                .Properties("AllowToolbarChanges") = True
                .Properties("AllowSpecialKeys") = True
                .Properties("AllowBypassKey") = True
                .Properties("AllowBreakIntoCode") = True
            End If
        End With
    End If
    Application.RefreshTitleBar
    Set prp = Nothing

Onother issue is to distribute the application without your administrative user account in the mdw file! Just keep a safe copy first or you close yourself out, for good!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top