SELECT Assets.AssetID, Assets.AssetDescription, [Asset
Categories].AssetCategory, Assets.EmployeeID, Status.Status
FROM Status RIGHT JOIN (Employees RIGHT JOIN ([Asset Categories] RIGHT JOIN
Assets ON [Asset Categories].AssetCategoryID = Assets.AssetCategoryID) ON
Employees.EmployeeID = Assets.EmployeeID) ON Status.StatusID = Assets.StatusID
WHERE ((([Asset Categories].AssetCategory)="Workstation") AND
((Status.Status)="On-Line")) OR ((([Asset
Categories].AssetCategory)="Server")) OR ((([Asset
Categories].AssetCategory)="Laptop"));
Ok, let's see if this can be untangled. Getting rid of some of Access'
extra parentheses we get:
SELECT Assets.AssetID, Assets.AssetDescription,
[Asset Categories].AssetCategory, Assets.EmployeeID, Status.Status
FROM Status RIGHT JOIN (Employees RIGHT JOIN ([Asset Categories] RIGHT
JOIN Assets ON [Asset Categories].AssetCategoryID =
Assets.AssetCategoryID) ON Employees.EmployeeID = Assets.EmployeeID)
ON Status.StatusID = Assets.StatusID
WHERE
[Asset Categories].AssetCategory="Workstation"
AND Status.Status)="On-Line"
OR
([Asset Categories].AssetCategory)="Server"
OR ([Asset Categories].AssetCategory="Laptop");
That is, it will retrieve the record if it's an online workstation; OR
if it's either a Server or a Laptop. Since you're connecting these by
OR, it will retrieve all the Servers and all the Laptops regardless of
whether they're online or not.
Could you maybe draw up a little "truth table" indicating which
records should be retrieved? I'm not sure of the logic you're trying
to attain!
John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps