Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Query Only Working in Parts

Status
Not open for further replies.

BigLouie

Technical User
Dec 1, 2005
876
US
I have an query that updates the cost of items with criteria. However only part of the criteria is working. It looks at both the line type and item number and updates the cost. While Access is correctly using the line type it ignores the item number part of the criteria and updates the cost on items it is not suppose to. Please see the code below. This is pasted as a SQL statement in a Query and run. Looking for thoughts on why it is not working.

UPDATE ARInvoice SET ARInvoice!Cost = ARInvoice!SOUnitCost*1.06
WHERE (((ARInvoice!LineType)="1") And ((ARInvoice!SOItemNumber)<>"SV-PATROLIR")) Or (((ARInvoice!LineType)="1") And ((ARInvoice!SOItemNumber)<>"SV-PATROLIR-9")) Or (((ARInvoice!LineType)="1") And ((ARInvoice!SOItemNumber)<>"SV-PATROLIR-Q")) Or (((ARInvoice!LineType)="1") And ((ARInvoice!SOItemNumber)<>"SV-PATROLIR-Q9")) Or (((ARInvoice!LineType)="1") And ((ARInvoice!SOItemNumber)<>"SV-PATROLIR-B2")) Or (((ARInvoice!LineType)="1") And ((ARInvoice!SOItemNumber)<>"SV-PATROLIER-B2-9")) Or (((ARInvoice!LineType)="1") And ((ARInvoice!SOItemNumber)<>"SV-PATROLIR-VSK")) Or (((ARInvoice!LineType)="1") And ((ARInvoice!SOItemNumber)<>"SV-PATROLIR-HSK"));
 
What about this ?
Code:
UPDATE ARInvoice
SET SOUnitCost=SOUnitCost*1.06
WHERE LineType='1' AND SOItemNumber NOT IN ('SV-PATROLIR','SV-PATROLIR-9','SV-PATROLIR-Q','SV-PATROLIR-Q9','SV-PATROLIR-B2','SV-PATROLIER-B2-9','SV-PATROLIR-VSK','SV-PATROLIR-HSK')

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top