Database Object.
You can use the AllowBreakIntoCode property to specify whether or not the user can view Visual Basic code after a run-time error occurs in a module.
The AllowBreakIntoCode property uses the following settings.
Setting | Description |
True (-1) | Enable the Debug button on the dialog box that appears when a error occurs. |
False (0) | Disable the Debug button. |
You can set this property by using a macro or Visual Basic. You can also set this property using the Allow Viewing Code After Error option in the Advanced section of the Startup dialog box, available by clicking Startup on the Tools menu. This is the easiest way to set this property.
You should not disable the AllowBreakIntoCode property when debugging application or macros.
This propertys setting does not take effect until the next time the application database opens.
This example shows procedure named SetStartupProperties that passes the name of the property to be set, its data type, and its desired setting. The general purpose procedure ChangeProperty attempts to set the startup property and, if the property is not found, uses the CreateProperty method to append it to the database properties collection. This is necessary because these properties do not appear in the properties collection until they have been set or changed at least once.
Sub SetStartupProperties() ChangeProperty "StartupForm", dbText, "Customers" ChangeProperty "StartupShowDBWindow", dbBoolean, False ChangeProperty "StartupShowStatusBar", dbBoolean, False ChangeProperty "AllowBuiltinToolbars", dbBoolean, False ChangeProperty "AllowFullMenus", dbBoolean, True ChangeProperty "AllowBreakIntoCode", dbBoolean, False ChangeProperty "AllowSpecialKeys", dbBoolean, True ChangeProperty "AllowBypassKey", dbBoolean, TrueSub ChangeProperty(strPropName As String, varPropType As Variant, _ varPropValue As Variant) As Integer Dim dbs As Database, prp As Property 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 ' prop not found. Set prp = dbs.CreateProperty(strPropName, _ varPropType, varPropValue) dbs.Properties.Append prp Resume Next Else ' unknown error. ChangeProperty = False Resume Change_Bye End IfFunction