正确使用的参数值无法使用 [英] Correctly assigned parameter valuecan not be used
本文介绍了正确使用的参数值无法使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过使用".oldValue"在更改条目之前获取cmb值.该值已正确分配(根据调试器),但是运行SQL Access要求手动输入.手动进行输入可以正常工作,因此其余代码应该可以.
I want to get a cmb-value before the entry is changed, by using ".oldValue". The value is correctly assigned (according to debugger), but running the SQL Access is asking for a manual entry. Doing the entry manually works fine, so the remaining code should be fine.
我的代码:
Dim CategoryNameBeforeChange As String
CategoryNameBeforeChange = Forms!frmCategory!txtCategoryName.OldValue
SQL = "UPDATE CategoryTbl " & _
"SET CategoryTbl.CategoryName = Forms!frmCategory!txtCategoryName " & _
"WHERE (CategoryTbl.CategoryName = CategoryNameBeforeChange);"
你知道这里出了什么问题吗?
Any idea what went wrong here?
任何帮助将不胜感激!
推荐答案
尝试一下:
SQL = "UPDATE CategoryTbl " & _
"SET CategoryTbl.CategoryName = Forms!frmCategory!txtCategoryName " & _
"WHERE (CategoryTbl.CategoryName = " & CategoryNameBeforeChange & ");"
我怀疑CategoryName是文本,在这种情况下应该是
I suspect that CategoryName is text, in this case it should be
SQL = "UPDATE CategoryTbl " & _
"SET CategoryTbl.CategoryName = Forms!frmCategory!txtCategoryName " & _
"WHERE (CategoryTbl.CategoryName = '" & CategoryNameBeforeChange & "');"
这篇关于正确使用的参数值无法使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文