Aha!
It is not working because you have no join specified that matches a ball in
one table with the same ball in the other. For example, if you had a BallID
field in each that uniquely identified each product, the SQL would be:
SELECT tblSafetyStock.[Ball Material], tblSafetyStock.[Ball Grade],
tblSafetyStock.[Ball Size], tblSafetyStock.[Ball Tolerance],
tblSafetyStock.[Safety Stock], [Material Traceability Table].Quantity
FROM [Material Traceability Table] INNER JOIN tblSafetyStock ON [Material
Traceability Table].BallID = tblSafetyStock.BallID
WHERE ((([Material Traceability Table].Quantity)<[tblSafetyStock]![Safety
Stock]));
In query design view, drag the matching field from one table to the other to
establish the join.
Hope that helps.
Sprinks
B_Lyles said:
SELECT tblSafetyStock.[Ball Material], tblSafetyStock.[Ball Grade],
tblSafetyStock.[Ball Size], tblSafetyStock.[Ball Tolerance],
tblSafetyStock.[Safety Stock], [Material Traceability Table].Quantity,
tblSafetyStock.Location
FROM [Material Traceability Table], tblSafetyStock
WHERE ((([Material Traceability Table].Quantity)<[tblSafetyStock]![Safety
Stock]));
Sprinks said:
Sounds strange. You may want to try a Compact and Repair, but go into the
SQL view of the query, and cut and post the SQL.
Sprinks
:
I've been trying that and instead of returning only the balls that are
greater than safety stock it will return all the balls and in the quantity it
will show the highest quantity for all the balls. If there's only one ball
less than safety stock and its value is 200, rather than just finding that
ball it returns all of them and assigns 200 to all of them. I'm stumped.
:
If you're doing the query in Query By Example view (the default), select all
fields that you wish to return, and in the Criteria row of the Quantity field
type:
< [Safety Stock]
If you're interested, you can see the SQL version of the query by switching
to SQL view (View, SQL).
Hope that helps.
Sprinks
:
Under criteria or table?
:
Select * from Table where Quantity<SafetyStock
Madhivanan