898
Professional Database Development Part IV
Because AllowBypassKey is a developer-only property, it is not built into Access databases.
You must create, append, and set this property sometime during the development process. Once
appended to the database??™s Properties collection, you can set and reset it as needed.
Here is the code you need to implement the AllowBypassKey property:
Function SetBypass(BypassFlag As Boolean) As Boolean
???Returns True if value of AllowBypassKey
???is successfully set to BypassFlag.
On Error GoTo SetBypass_Error
Dim db As DAO.Database
Set db = CurrentDb
db.Properties!AllowBypassKey = BypassFlag
SetBypass_Exit:
Exit Function
SetBypass_Error:
If Err = 3270 Then
???AllowBypassKey property does not exist
MsgBox ???Appending AllowBypassKey property???
db.Properties.Append _
db.CreateProperty(???AllowBypassKey???, _
dbBoolean, BypassFlag)
SetBypass = True
Resume Next
Else
???Some other error
MsgBox ???Unexpected error: ??? & Error$ _
& ??? (??? & Err & ???)???
SetBypass = False
Resume SetBypass_Exit
End If
End Function
This function first tries to set the AllowBypassKey property to whatever value is passed in
as BypassFlag.
Pages:
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705