Set new property to database : Database Properties « Access « VBA / Excel / Access / Word






Set new property to database

 

Sub KeepEmOut()
    Dim db As Database
    Dim pty As Property
    On Error GoTo KeepEmOut_Err
    Set db = CurrentDb
    db.Properties("AllowBypassKey").Value = False
KeepEmOut_Exit:
    Exit Sub
KeepEmOut_Err:
    If Err.Number = 3270 Then
        Set pty = db.CreateProperty("AllowBypassKey", dbBoolean, False)
        db.Properties.Append pty
    Else
        Debug.Print Err.Description
        Resume KeepEmOut_Exit
    End If
    
End Sub

 








Related examples in the same category

1.Enumerate the properties of current database
2.Sub KeepEmOut()
3.Database properties: AllowFullMenus, Allowtoolbarchanges
4.reset any values you set
5.Changing Options