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!

Need advise on update query...it might not be updating all the values

Status
Not open for further replies.

Pack10

Programmer
Feb 3, 2010
495
US
I am working on an update query that is not working correctly.
I am working with a table that contains 28 fields that can contain the value "Major" or "Minor" or "Major & Minor".
They are error fields that come from a linked Sharepoint table.
I have 3 criteria fields, which are:
Status = “Completed” or “Rejected” Or “Reject”
Overall status = ‘major=Major fail” or “minor=minor fail”
And a date calculation that must be btw 0 and 6. (Basically within 6 days of the weekending date).
I have an IIf statement in each of the 28 fields...
IIf([fieldname]="Major" Or [fieldname] = "Minor" Or [fieldname]="Major & Minor",1,0)
with the 1 in each criteria row of the "OR" condition.
So, each field in the query grid has the value 1 one line lower because of the or condition.

Then each row contains “Completed” or “Rejected” Or “Reject” for the status criteria and
‘Major=Major fail” or “Minor=minor fail” for the Overall status criteria.
And the field that contains the "Update message".
My question is....we export the table to excel and examine it...my manager says not all the rows are being updated...
since there are so many fields in the OR statement....am I better off breaking it into single queries and just run them via a macro? Does it sound like my approach is correct?

thanks for the feedback, so sick of looking at this query.
_______________________________________________________________________________________________________________________
status overall status date field1 field 2 field3 field 4......
“Completed” or “Rejected” Or “Reject”

 
Why don't you post the query and the table structure you are trying to update??

Kevin
 
Why not write a function that contains all the logic and then pass the columns to it? At least it will be easier to maintain.

Secondly, for repeated logic I'll often concatenate a mess of stuff together in Excel or a query to get all the update set lines or columns (whatever) and paste the mess back into SQL view.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top