Help with SQL statement

JBurlison

Registered User.
Local time
Today, 10:20
Joined
Mar 14, 2008
Messages
172
this code should bring up the owner "ECI" and all the other criteria falling under ECI but its bringing up everyone it is not adding the ECI critera. Just the Server, desktop, tablet,and laptop criteria regurdless of who ownes it. PLEASE HELP IM A SQL NOOB!

Code:
SELECT [Main Inventory].[Sai Serial Number], [Main Inventory].[Software installled 1], [Main Inventory].[Software Key 1], [Main Inventory].[Software installled 2], [Main Inventory].[Software Key 2], [Main Inventory].[Software installled 3], [Main Inventory].[Software Key 3]
FROM [Main Inventory]
WHERE ((([Main Inventory].Owner)="ECI") AND (([Main Inventory].[Product Type])="Desktop")) OR ((([Main Inventory].[Product Type])="Laptop PC")) OR ((([Main Inventory].[Product Type])="Server")) OR ((([Main Inventory].[Product Type])="Tablet PC"));
 
The Bracketing looks wrong try
WHERE ((([Main Inventory].Owner)="ECI") AND (([Main Inventory].[Product Type])="Desktop") OR (([Main Inventory].[Product Type])="Laptop PC") OR (([Main Inventory].[Product Type])="Server") OR (([Main Inventory].[Product Type])="Tablet PC"));

Brian
 
Humm still comes up with the other owners is there a way i can do the where in the select function to initially select "ECI" from the owners?
 
You need to add "AND (([main inventory].owner)="ECI")) " for each or statement so it's like this:

Code:
WHERE ((([main inventory].[product type])="Laptop PC") AND (([main inventory].owner)="ECI")) OR ((([main inventory].[product type])="Tablet PC") AND (([main inventory].owner)="ECI")) OR ((([main inventory].[product type])="Server") AND (([main inventory].owner)="ECI"));
 
ahhh changed to this:

Code:
SELECT [Main Inventory].[Sai Serial Number], [Main Inventory].[Software installled 1], [Main Inventory].[Software Key 1], [Main Inventory].[Software installled 2], [Main Inventory].[Software Key 2], [Main Inventory].[Software installled 3], [Main Inventory].[Software Key 3], [Main Inventory].Owner, [Main Inventory].[Product Type]
FROM [Main Inventory]
WHERE ((([Main Inventory].Owner)=Forms![Main inventory License Keys]!Combo0) And (([Main Inventory].[Product Type]) In ("Desktop","Laptop PC","Server","Tablet PC")));

 
I got the bracketing wrong too, another set is required around all of the Ors.

Brian
 

Users who are viewing this thread

Back
Top Bottom