简体   繁体   English

如何避免警告“您将无法撤消此操作查询即将对链接表中的数据进行的更改”

[英]How to avoid alert “You won't be able to undo the changes this action query is about to make to the data in a linked table or tables”

I wrote a code to call a module on the button click in Access form and when I click on d button, i recieve d following alerts:我编写了一个代码来调用 Access 表单中的按钮单击模块,当我单击 d 按钮时,我收到以下警报:

"You won't be able to undo the changes this action query is about to make to the data in a linked table or tables" “您将无法撤消此操作查询即将对链接表中的数据进行的更改”

and

"You are about to update X row(s)". “您即将更新 X 行”。

The code behind the button is:按钮背后的代码是:

Private Sub UpdateRS_Click()
    Call UpdateModul.Update
End Sub

And module is:模块是:

Public Function Update()
DoCmd.RunSQL "Update tbl03 INNER JOIN tblMaster " & _
 "ON tbl03.KW = tblOnd_RS.KW " & _
 "SET tbl03.CAp = [tblMaster].[CAp] "
End Function

How to avoid these alert messages?如何避免这些警报消息? I appreciate any help.我很感激任何帮助。

See http://www.fmsinc.com/microsoftaccess/query/action-queries/SuppressWarningMessages.htm and http://www.utteraccess.com/wiki/index.php/RunSQL_vs_Execute .请参阅http://www.fmsinc.com/microsoftaccess/query/action-queries/SuppressWarningMessages.htmhttp://www.utteraccess.com/wiki/index.php/RunSQL_vs_Execute

You could use你可以用

DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE ..."
DoCmd.SetWarnings True

but this has multiple problems, eg an error could prevent DoCmd.SetWarnings True from running, which then could lead to disaster.但这有多个问题,例如错误可能会阻止DoCmd.SetWarnings True运行,从而导致灾难。

Much better is:更好的是:

Dim db As DAO.Database
Set db = CurrentDb  
db.Execute "UPDATE ...", dbFailOnError

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 日期数据不会从“生成表查询(访问)”中的表单中填充 - Date data won't populate from form in Make Table Query (Access) 如何在Access中进行UNION查询以合并来自多个表的数据,并且还用名为“ SignedOffClientList”的表排除匹配的数据? - How to make UNION query in Access to combine data from multiple tables and ALSO exlude matched data with table named 'SignedOffClientList'? ODBC更改时如何刷新Access mdb中的链接表 - How to refresh linked tables in an Access mdb when ODBC changes 如何撤消框架更改的更改? - How to undo changes of framework change? 如何停止链接表的编辑,以免更改实际的表数据MS Access 2013? - How to stop edits on linked tables from changing the actual table data MS Access 2013? 您如何以编程方式在Access中更新链接表,该链接表也将刷新数据类型? - How do you programmatically update a linked table in Access that will refresh data types too? 如何在Access中创建关于数据表的汇总表 - How to make summary table of with respect to data in tables in access 如果链接的数据源发生更改,则在表中附加记录的副本 - Append a copy of the records in a table if a linked data source changes 链接表上的PDO ODBC查询不会给出任何结果 - PDO ODBC query on linked tables doesn't give any results 打开 Access DB 时如何避免链接表管理器消息 - How to avoid Linked Table manager message while opening the Access DB
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM