MS Access启动属性 [英] MS Access Start up Properties

查看:68
本文介绍了MS Access启动属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在在线玩一些代码,并在我的项目中尝试了以下操作以禁用默认访问功能区

I was playing with some code online and tried the following in my project to disable default access ribbon

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

我在表单上设置了按班次转换键代码",但是在我打开应用程序时,我没有将其设置为要加载的第一个表单.有什么办法可以绕过它并返回我的应用程序?

I set a By Pass Shift Key Code on a form but i hadn't set it as the first form to load when i opened the application. is there any way i can bypass this and return to my application?

推荐答案

从上面的内容我了解到您已禁用Shift键旁路.最好的办法是在运行此危险代码之前使用您创建的副本:)如果不可能,请参考以下几点:首先,您将需要代码来更改锁定数据库中的代码.

From the above I understand that you have disabled the shift-key bypass. The best thing to do would be to use the copy you created before running this dangerous code :) If that is not possible, here are some ideas, first, you will need code to change the code in the locked database.

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

如果选择了OR,则现在必须创建一个名为Autoexec的宏:

If you have chosen OR, you will now have to create a macro called Autoexec:

RunCode : RunMe()

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

And export that macro to your damaged database. Be very careful, back-up everything first.

这篇关于MS Access启动属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆