I'm stumped with this query

edkocol

Registered User.
Local time
Yesterday, 17:48
Joined
Oct 2, 2012
Messages
30
I'm stumped with this query - solved - see post #9

[EDIT:] SOLVED see post #9

This query:
Code:
SELECT B_Inventory.Barcode, 
           B_Inventory.QtyOnHand, 
           B_Inventory.QtyInPO, 
           A_ScriptPODetail.Quantity, 
           A_ScriptPODetail.ScriptPOID
   FROM B_Inventory INNER JOIN A_ScriptPODetail ON B_Inventory.Barcode=A_ScriptPODetail.Barcode
 WHERE (((B_Inventory.QtyOnHand)=(B_Inventory.QtyInPO)) 
     And ((B_Inventory.QtyInPO)>0) 
     And ((A_ScriptPODetail.Quantity)=(B_Inventory.QtyInPO)) 
     And ((A_ScriptPODetail.Shipped)=(Yes)));

Produces these results:
Open.jpg


Yet, this query:
Code:
SELECT B_Inventory.Barcode, 
           B_Inventory.QtyOnHand, 
           B_Inventory.QtyInPO, 
           A_ScriptPODetail.Quantity, 
           A_ScriptPODetail.ScriptPOID 
   FROM B_Inventory INNER JOIN A_ScriptPODetail ON B_Inventory.Barcode=A_ScriptPODetail.Barcode
 WHERE (((B_Inventory.QtyOnHand)=(B_Inventory.QtyInPO)) 
     And ((B_Inventory.QtyInPO)>0) And ((A_ScriptPODetail.Quantity)=(B_Inventory.QtyInPO)) 
     And ((A_ScriptPODetail.Shipped)=(Yes)) 
     And ((A_ScriptPODetail.ScriptPOID)=22252));

Notice the
Code:
And ((A_ScriptPODetail.ScriptPOID)=22252))
at the end....

Produces these results:
Closed.jpg


I am baffled. What am I missing?
 
Last edited:
is 22252 a text value? If it is formatted in the table as a text value, you will need to surround it in quotes, ie. "22252"

Alan
 
Sorry, I should have said it is a Number.
 
Indulge me. Try surrounding the value in quotes and advise what happens.
 
Already did that. I was told:

Data misimatch type in criteria expression
 
Thanks; just checking. Can you upload a copy of your DB so that we can do some analysis. Run a compact and repair before zipping. If you have confidential information in it, dummy those records up. Also, don't need all the data, just some sample data to run analysis on.
 
I wonder if this has a bearing?

A_ScriptPODetail.ScriptPOID is defined in the table design as a lookup based on another table's primary key (A_ScriptPO.ScriptPOID = autonumber).
 
Re: I'm stumped with this query - Solved

Solved.

The lookup specs for column A_ScriptPODetail.ScriptPOID is displaying the value of A_ScriptPO.PurchaseOrderNumber not A_ScriptPO.ScriptPOID.

I now understand the relationship of these two table.

BTW, I "inherited" this system and I am learning it as I go.
 

Users who are viewing this thread

Back
Top Bottom