Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2003
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automatically change Startup properties (Access 2000)

    We have a database with no implemented security nor does the boss want to split the database. Some users who need to complete a Startup form do not know Microsoft Access; thus, we have changed the Startup properties of the database to the following settings so that hopefully users will not be tempted to fool around with the database and/or its objects. (The user form has command buttons on it that allow users to print the form, or close the form and exit Access, which is all they need to do after they input the data.)

    "StartupShowDBWindow", False
    "StartupShowStatusBar", True
    "AllowBuiltinToolbars", False
    "AllowFullMenus", False
    "AllowBreakIntoCode", False
    "AllowSpecialKeys", True
    "AllowBypassKey", False

    Two users will want to be able to run the following procedure to change the Startup properties in order to modify the database. The procedure is currently in a password protected module in the database.

    Can anyone suggest code that would run this procedure with, say, a special keyboard shortcut after the database is opened exclusively, refresh the database with the new settings WITHOUT exiting the database, and then, when the database is closed, suggest another procedure that will run automatically to change the Startup properties back to the original above-mentioned settings? Appreciate any help you can give me. Many thanks...Mary

    Sub SetStartupProperties()
    Const DB_Text As Long = 10
    Const DB_Boolean As Long = 1
    ChangeProperty "StartupShowDBWindow", DB_Boolean, True
    ChangeProperty "StartupShowStatusBar", DB_Boolean, True
    ChangeProperty "AllowBuiltinToolbars", DB_Boolean, True
    ChangeProperty "AllowFullMenus", DB_Boolean, True
    ChangeProperty "AllowBreakIntoCode", DB_Boolean, True
    ChangeProperty "AllowSpecialKeys", DB_Boolean, True
    ChangeProperty "AllowBypassKey", DB_Boolean, True
    End Sub

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Automatically change Startup properties (Access 2000)

    This is going to be a nightmare. The modified startup options will only be effective after closing and reopening the database - that's why they are called startup options; you can't "refresh the database with the new settings WITHOUT exiting the database". If the "wrong" user happens to open the database just when it has been saved with the "insecure" settings, he/she can do anything...

    Your boss may not want to split the database, but bosses are not always right. It is much easier to create a separate database with tables linked to the original one, and have a different set of startup options in each.

  3. #3
    2 Star Lounger
    Join Date
    Jan 2003
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatically change Startup properties (Access 2000)

    Thanks, Hans; that is what I was afraid of! I'll have to see what I can do toconvince them to split the database. Appreciate your quick response! Thank you...Mary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •