Sub KeepEmOut() : Database Properties « Access « VBA / Excel / Access / Word






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       'Error code for "Property not found"...
        'so we'll create it ourselves
        Set pty = db.CreateProperty("AllowBypassKey", dbBoolean, False)
        db.Properties.Append pty
    Else
        MsgBox Err.Description
        Resume KeepEmOut_Exit
    End If
    
End Sub

 








Related examples in the same category

1.Set new property to database
2.Enumerate the properties of current database
3.Database properties: AllowFullMenus, Allowtoolbarchanges
4.reset any values you set
5.Changing Options