如何以编程方式更改Access中的选项?

时间:2022-08-25 23:36:03

in Microsoft Access, is there a way which I can programatically set the Confirm Action Queries flag on the options screen to False? Ideally when the database is started up I would like to check if it's true, and if so, mark it as false for the currently logged in user.

在Microsoft Access中,有没有一种方法可以在选项屏幕上以编程方式将Confirm Action Queries标志设置为False?理想情况下,当数据库启动时,我想检查它是否为真,如果是,请将当前登录用户标记为false。

The application is locked down reasonably tightly, so ideally, we don't want to have to give users acces to the action menu.

应用程序被合理地锁定,因此理想情况下,我们不希望让用户访问操作菜单。

Thanks in advance.

提前致谢。

PG

3 个解决方案

#1


1  

Place the following in a method when the database starts:

在数据库启动时将以下内容放在方法中:

If Application.GetOption("Confirm Action Queries") Then
    Application.SetOption "Confirm Action Queries", False
End If

#2


0  

It is usually better to either use Execute or Set Warnings to get rid of the warning on action queries because options apply to all databases. If you change the options in code, I recommend that you set them back before exiting (and hope that exits are not unexpected) or someone might get an unpleasant surprise when the expected prompt does not appear in their application.

通常最好使用Execute或Set Warnings来消除对操作查询的警告,因为选项适用于所有数据库。如果您更改代码中的选项,我建议您在退出之前将其设置回来(并希望退出不是意外),或者当预期的提示未出现在他们的应用程序中时,某人可能会感到不愉快。

#3


0  

I am assuming that you want to turn this option off becuase you are running queries from code. You can turn off all query prompts by using the macro action SetWarnings. Available from VBA as a method of the DoCmd object. Remember to turn it back on again after your code has completed. You can also avoid the warning by using the Execute method in either ADO or DAO.

我假设您要关闭此选项,因为您正在从代码运行查询。您可以使用宏操作SetWarnings关闭所有查询提示。可从VBA作为DoCmd对象的方法获得。请记住在代码完成后再次将其重新打开。您还可以通过在ADO或DAO中使用Execute方法来避免警告。

#1


1  

Place the following in a method when the database starts:

在数据库启动时将以下内容放在方法中:

If Application.GetOption("Confirm Action Queries") Then
    Application.SetOption "Confirm Action Queries", False
End If

#2


0  

It is usually better to either use Execute or Set Warnings to get rid of the warning on action queries because options apply to all databases. If you change the options in code, I recommend that you set them back before exiting (and hope that exits are not unexpected) or someone might get an unpleasant surprise when the expected prompt does not appear in their application.

通常最好使用Execute或Set Warnings来消除对操作查询的警告,因为选项适用于所有数据库。如果您更改代码中的选项,我建议您在退出之前将其设置回来(并希望退出不是意外),或者当预期的提示未出现在他们的应用程序中时,某人可能会感到不愉快。

#3


0  

I am assuming that you want to turn this option off becuase you are running queries from code. You can turn off all query prompts by using the macro action SetWarnings. Available from VBA as a method of the DoCmd object. Remember to turn it back on again after your code has completed. You can also avoid the warning by using the Execute method in either ADO or DAO.

我假设您要关闭此选项,因为您正在从代码运行查询。您可以使用宏操作SetWarnings关闭所有查询提示。可从VBA作为DoCmd对象的方法获得。请记住在代码完成后再次将其重新打开。您还可以通过在ADO或DAO中使用Execute方法来避免警告。