SQL语句中的动态查找 [英] Dynamic lookup in SQL sentence
问题描述
大家好!
我的代码有些麻烦
我有这句话:
DoCmd.RunSQL" UPDATE [tbl productlines] SET ProductQuantity = 0 WHERE" ordernumber =" &安培; me.ordernumber;
用于通过按钮从主窗体更新子窗体。
ting是我需要的ProductQuantity使用ProductNumber(它在它尝试更新的子表单中找到)作为标识符查找另一个表中的值。
我曾尝试使用Dlookup(ProductQuantity,TBL ProductInformation,Productnumber =& me.productnumber),但它失败了。
请帮助我:)
Hello guys!
I have some trouble with my code
I have this sentence:
DoCmd.RunSQL "UPDATE [tbl productlines] SET ProductQuantity = 0 WHERE "ordernumber =" & me.ordernumber;"
which i use to update a subform from a mainform by button.
The ting is i need the ProductQuantity to lookup the value in a another table with a ProductNumber (which it finds at the subform it is trying to update) as identifier.
I have tried to use the Dlookup("ProductQuantity", "TBL ProductInformation", "Productnumber=" & me.productnumber) but it fails.
Please help me :)
推荐答案
当我使用DLookup(产品数量,tbl ProductInformation, ; ProductNumber ="& [Form_orderline] .Productnumber)
它使用ProductInformation中的第一个ProductQuantity记录[tbl Productline]中的所有记录
如何我可以使这个dlookup使用SQL语句中的productnumber而不是子表单吗?
When i use the DLookup("Product quantity", "tbl ProductInformation", "ProductNumber = " & [Form_orderline].Productnumber)
it uses the first ProductQuantity record from Productinformation on all records in [tbl Productline]
How can i make this dlookup use the productnumber in the SQL sentence and not in the subform?
你的引号都是错误的。试试这个...
Your quotes are all wrong. Try this ...
您的报价都错了。试试这个...
Your quotes are all wrong. Try this ...
这篇关于SQL语句中的动态查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!