本文介绍了VBA SQL问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下查询显示错误
请帮助:
DoCmd.RunSQL ("insert into tbltesting (IsDiff)values ('Yes') where empid= '" & Me.txtEmpId.Value & "' and testid= '" & Me.txtAutoNumber.Value & "'")
推荐答案
我将猜测empid和testid是数字,而您将它们设置为SQL语句中的字符串就可以了.删除包裹在字段引用周围的单引号.
I'm going to guess that empid and testid are numeric, and you're setting them off like they're strings in the SQL statement. Remove the single-quotes that you've wrapped around your field references.
DoCmd.RunSQL (" Update tbltesting set IsDiff ='Yes' where empid= " & Me.txtEmpId.Value & " and testid= " & Me.txtAutoNumber.Value & ";")
这篇关于VBA SQL问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!