Ms access MS Access启动属性

Ms access MS Access启动属性,ms-access,Ms Access,我在网上玩一些代码,并尝试在我的项目中禁用默认访问功能区 Sub DisableStartupProperties() ChangeProperty "StartupShowDBWindow", dbBoolean, False ChangeProperty "StartupShowStatusBar", dbBoolean, False ChangeProperty "AllowBuiltinToolbars", dbBoolean, False Chan

我在网上玩一些代码,并尝试在我的项目中禁用默认访问功能区

Sub DisableStartupProperties()
    ChangeProperty "StartupShowDBWindow", dbBoolean, False 
    ChangeProperty "StartupShowStatusBar", dbBoolean, False 
    ChangeProperty "AllowBuiltinToolbars", dbBoolean, False 
    ChangeProperty "AllowFullMenus", dbBoolean, False 
    ChangeProperty "AllowBreakIntoCode", dbBoolean, False 
    ChangeProperty "AllowSpecialKeys", dbBoolean, False 
    ChangeProperty "AllowBypassKey", dbBoolean, False 
    ChangeProperty "AllowShortcutMenus", dbBoolean, False
End Sub

Function 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
        Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue)
        dbs.Properties.Append prp
        Resume Next
    Else
        ChangeProperty = False
        Resume Change_Bye
    End If
End Function

我在表单上设置了一个旁路Shift键代码,但在打开应用程序时没有将其设置为要加载的第一个表单。是否有任何方法可以绕过此设置并返回到我的应用程序?

从上面我了解到您已禁用shift键旁路。最好的办法是使用在运行此危险代码之前创建的副本:)如果不可能,下面是一些想法,首先,您需要代码来更改锁定数据库中的代码

Dim apAccess As New Access.Application
Dim strCodeLine As String
Dim lngLine As Long

''Where "c:\docs\test.mdb" is your database
apAccess.OpenCurrentDatabase "c:\docs\test.mdb"

''Where module2 is the name of your module  
With apAccess.VBE.ActiveVBProject.VBComponents("Module2").CodeModule
    s = "ChangeProperty ""AllowBypassKey"", dbBoolean, False"

    lngLine = 1

    ''EITHER
    ''This is useful if the code runs on start-up, if not, see OR
    If .Find(s, lngLine, 1, -1, -1) Then
        .ReplaceLine lngLine, Replace(s, "False", "True")
    End If

    ''OR
    ''Assuming that "Call DisableStartupProperties" is in a module, not a form
    If .Find("DisableStartupProperties", lngLine, 1, -1, -1) Then
        s = "Function RunMe()" & vbCrLf & s & vbCrLf & "End Function"

        .InsertLines lngLine - 1, s
    End If
End With
如果选择了或,则现在必须创建一个名为Autoexec的宏:

RunCode : RunMe()

并将该宏导出到损坏的数据库中。非常小心,首先备份所有内容。

从上面我了解到您已禁用换档钥匙旁路。最好的办法是使用在运行此危险代码之前创建的副本:)如果不可能,下面是一些想法,首先,您需要代码来更改锁定数据库中的代码

Dim apAccess As New Access.Application
Dim strCodeLine As String
Dim lngLine As Long

''Where "c:\docs\test.mdb" is your database
apAccess.OpenCurrentDatabase "c:\docs\test.mdb"

''Where module2 is the name of your module  
With apAccess.VBE.ActiveVBProject.VBComponents("Module2").CodeModule
    s = "ChangeProperty ""AllowBypassKey"", dbBoolean, False"

    lngLine = 1

    ''EITHER
    ''This is useful if the code runs on start-up, if not, see OR
    If .Find(s, lngLine, 1, -1, -1) Then
        .ReplaceLine lngLine, Replace(s, "False", "True")
    End If

    ''OR
    ''Assuming that "Call DisableStartupProperties" is in a module, not a form
    If .Find("DisableStartupProperties", lngLine, 1, -1, -1) Then
        s = "Function RunMe()" & vbCrLf & s & vbCrLf & "End Function"

        .InsertLines lngLine - 1, s
    End If
End With
如果选择了或,则现在必须创建一个名为Autoexec的宏:

RunCode : RunMe()

并将该宏导出到损坏的数据库中。请非常小心,首先备份所有内容。

如果您使用VBA代码锁定了数据库,请不要担心。 有一种简单的方法,只需复制数据库并粘贴到不受信任的位置

Access将向您显示一条警告:不要单击“启用”

现在您可以关闭窗体,启用导航面板并取消隐藏对象

更改代码后,将文件保存到受信任的位置


希望您能理解我的意思。

如果您使用VBA代码锁定了数据库,请不要担心。 有一种简单的方法,只需复制数据库并粘贴到不受信任的位置

Access将向您显示一条警告:不要单击“启用”

现在您可以关闭窗体,启用导航面板并取消隐藏对象

更改代码后,将文件保存到受信任的位置

希望你能理解我