在Ms访问中运行报告生成不正确的结果 [英] Running Report in Ms access Generates incorrect result

查看:46
本文介绍了在Ms访问中运行报告生成不正确的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个文本框的表格。用户可以在其中任何一个或全部输入值。输入值并单击按钮后,将生成报告。

现在问题是如果我在文本框中输入所有3个值,而不是获得1个单个记录,我将获得多个记录。



          "INSERT INTO TmpContainersForPLReport" &安培; _

                    "SELECT Containers。*,Shipments.ShipmentInvoiceNumber FROM Containers INNER JOIN Shipments ON(Containers.ShipmentID = Shipments.ShipmentID)  WHERE Con​​tainers.PackinglistentryDate
=#" &安培; TxtEntryDate& "#" &安培; _

                    "或(Containers.SalesOrderNumber ='"& txtSalesOrderNumber&"')OR(Containers.PONumber ='"& TxtPONumber&"')OR(Shipments.ShipmentInvoiceNumber
='"& ; txtShipmentInvNum&"')" &安培; _

                    "或((Containers.SalesOrderNumber ='"& txtSalesOrderNumber&"')和(Containers.PONumber ='"& TxtPONumber&"')和(Shipments.ShipmentInvoiceNumber
='" & txtShipmentInvNum&"'))" &安培; _

                    " OR(Containers.SalesOrderNumber ='"& txtSalesOrderNumber&"'And Containers.PONumber ='"& TxtPONumber&"')" &安培; _

                    " OR(Containers.PONumber ='"& TxtPONumber&"'And Shipments.ShipmentInvoiceNumber ='& txtShipmentInvNum&"')" &安培; _

                    "或(Containers.SalesOrderNumber ='"& txtSalesOrderNumber&"'And  Shipments.ShipmentInvoiceNumber ='"& txtShipmentInvNum&"')"

  

最终报告是从TmpContainersForPLReport获取值。



谢谢

解决方案


我想知道你在WHERE子句中使用OR而不是ANDs是否与你有任何关系。


希望它有助于...


Hi, I have form with 3 textboxes. The user can enter values in either of them or all of them. Upon entering the values and clicking a button a report is generated.
Now the problem is if i enter all the 3 values in the textbox, instead of getting 1 single record, i'm getting multiple records.

          "INSERT INTO TmpContainersForPLReport " & _
                    "SELECT Containers.*,Shipments.ShipmentInvoiceNumber FROM Containers INNER JOIN Shipments ON (Containers.ShipmentID = Shipments.ShipmentID)  WHERE Containers.PackinglistentryDate = #" & TxtEntryDate & "# " & _
                    " OR (Containers.SalesOrderNumber = '" & txtSalesOrderNumber & "') OR (Containers.PONumber = '" & TxtPONumber & "') OR (Shipments.ShipmentInvoiceNumber = '" & txtShipmentInvNum & "' )" & _
                    " OR ((Containers.SalesOrderNumber = '" & txtSalesOrderNumber & "')And(Containers.PONumber = '" & TxtPONumber & "') And (Shipments.ShipmentInvoiceNumber = '" & txtShipmentInvNum & "')) " & _
                    " OR (Containers.SalesOrderNumber = '" & txtSalesOrderNumber & "' And Containers.PONumber = '" & TxtPONumber & "')" & _
                    " OR (Containers.PONumber = '" & TxtPONumber & "' And Shipments.ShipmentInvoiceNumber = '" & txtShipmentInvNum & "')" & _
                    " OR (Containers.SalesOrderNumber = '" & txtSalesOrderNumber & "' And  Shipments.ShipmentInvoiceNumber = '" & txtShipmentInvNum & "' )"
  
The final report is getting values from TmpContainersForPLReport.

Thankyou

解决方案

Hi,

I wonder if it has anything to do with you using ORs rather than ANDs in your WHERE clause.

Hope it helps...


这篇关于在Ms访问中运行报告生成不正确的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆