访问MySQL的前端:表格赢得或更新记录
我使用连接到MySQL数据库的访问应用程序有问题。 我在一个带有VBA过程的小表上测试更新,
UPDATE tblFormateur
SET Prenom = 'Werner'
WHERE Nom='HEISENBERG' "
第一次运行查询时使用DAO,没关系。 但是,如果我运行相同的查询,而不会更改值(保持Prenom ='Werner') 我收到一条错误消息,说查询尚未执行, 由于违反锁。 如果我再次运行查询,但是具有不同的值,例如Prenom ='Peter', 查询是无错误执行的。
另一方面,如果我对AdoDB进行相同的实验, 我没有任何错误。
一个人可以说:让我们和Adodb一起!
问题是访问申请表使用DAO,而不是ADODB! 因此,所有表格将无法添加新记录或更新记录。
您遇到了同样的问题吗? 是否需要设置ODBC驱动程序的某些参数?
感谢您的任何帮助。
Windows 11 访问办公室365 ODBC连接器8.0 CE
I have a problem using an Access Application connected to a MySql Database.
I test UPDATE on one small table with a VBA procedure, using DAO
UPDATE tblFormateur
SET Prenom = 'Werner'
WHERE Nom='HEISENBERG' "
The first time I run the query, it's ok.
But if I run the same query, without changing the value,(keeping Prenom = 'Werner')
I get an error message saying that the query has not been executed,
due to a lock violation.
If I run the query again, but with a different value, e.g Prenom = 'Peter',
the query is executed without error.
On the other hand, If I do the same experiment with ADODB,
I do not get any error.
One can say: let's go with ADODB!
The problem is that the Access application Forms use DAO, not ADODB!
So all the forms won't be able to either add new records or update records.
Did you experienced the same issue?
Are there some parameters of the ODBC driver that needs to be set?
Thank's advance for any help.
Windows 11
Access Office 365
ODBC connector 8.0 CE
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的链接表作为
Recordsource
并运行更新查询,则总是会给您这个错误。出现错误是因为访问未检测到任何更改。如果您的字段具有值“测试”,并且比删除此值,重写为“测试”,则访问不会检测任何更改,因为该值是相同的。
要绕过此错误,您可以在运行查询之前创建一个随机字段,该字段在运行查询之前添加n + 1。当您打开表单时,字段设置为0,在运行查询为1之前,下次是2,依此类推。
访问将检测到表单的更改,不会给您这个错误。
If you have a linked table as form
RecordSource
and you run an update query, it always give you this error.The error appears because Access do not detect any changes. If you have a field with value 'Test' and than you delete this value, rewrite 'Test', Access doesn't detect any changes because the value is the same.
To bypass this error you can make a random field that add n + 1 before running your query. When you open the form, field is set to 0, before you run the query is 1, next time is 2 and so on.
Access will detect changes to the form and won't give you this error.