gpt4 book ai didi

ms-access - 宏错误 2001 Autoexec Access 宏

转载 作者:行者123 更新时间:2023-12-03 08:21:05 26 4
gpt4 key购买 nike

我在 Access 2016 数据库上设置了 Autoexec 宏,以根据 Environ("USERNAME") 确定要打开的表单.

当我打开数据库时,出现宏错误 2001。如果我单击停止所有宏,我可以继续使用数据库而不会出现问题,直到我更改文件名,然后问题再次发生。

是否有任何选项可以防止发生此错误?

被调用的代码是

LUser = LCase(Environ("USERNAME")) 'Get current username

DoCmd.OpenForm "frmDash", acNormal, , , , acWindowNormal

If IsNull(DLookup("[sysname]", "tblaccmannew", "sysname=" & "'" & LUser & "'")) Then
DoCmd.OpenForm "frmSearch", acNormal, , , , acWindowNormal
Forms!frmDash.Visible = False
End If

最佳答案

您需要“信任”数据库的位置。

.

指定受信任的位置(Access 2013 和 2016)

  1. On the File tab, click Options.

  2. In the Access Options dialog box, on the left, click Trust Center.

  3. On the right, under Microsoft Office Access Trust Center, click Trust Center Settings.

  4. In the left pane of the Trust Center dialog box, click Trusted Locations.

  5. To add a network location, in the right pane, select the Allow Trusted Locations on my network check box.

  6. Click Add new location.

  7. In the Microsoft Office Trusted Location dialog box, use one of the following methods:

    • In the Path box, type the full path of the location that you want to add.

    • Click Browse to browse to the location.

  8. To specify that subfolders of the new trusted locations should also be trusted, select the Subfolders of this location are also trusted check box.

  9. Optionally, in the Description box, type a description for the trusted location.

(Source)

关于ms-access - 宏错误 2001 Autoexec Access 宏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47457648/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com