Full Version: Update Query Updates Outside Criteria
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
Iulique
Hi ,

I have an update query that has to update some fields in a table based on a controls in a form and a static criteria set within the query.

One of the fields that has to be updated also contains the static criteria.

When i view the results of the query in design mode all is ok, the correct number of records is displayed, but when i run the query , it tries to update like there is no static criteria.
Below is the sql code of the query.

it looks like the query ignores the first condition <Component_Issues.Status) Like "Open">

Could it be that this is happening because field <Component_Issues.Status> is also targeted for update by the query? if so what should i do?


UPDATE Components_Receiving INNER JOIN (Components_Types INNER JOIN (Component_Individual_Issues INNER JOIN Component_Issues ON Component_Individual_Issues.ID_Comp_Indiv_Isssue = Component_Issues.fk_ID_Comp_Indiv_Isssue) ON Components_Types.ID_Comp_Type = Component_Individual_Issues.[Applicable to].Value) ON Components_Receiving.ID_Comp_Received = Component_Issues.fk_Component_Received_ID SET Component_Issues.Status = "Closed", Component_Issues.Resolution = [Forms]![Components_Types_Individual_Issues]![Text16], Component_Issues.[Closed by] = [Forms]![Components_Types_Individual_Issues]![Closed by], Component_Issues.[Closed date] = [Forms]![Components_Types_Individual_Issues]![Closed date]
WHERE (((Component_Issues.Status) Like "Open") AND ((Component_Issues.fk_ID_Comp_Indiv_Isssue)=[Forms]![Components_Types_Individual_Issues]![Combo14]));
orange999
UPDATE queries can be dangerous. There really isn't an UNDO button so to speak.

You may want to use a SELECT query first, to confirm which records are being identified for the proposed Update.
Also, your use of the LIKE operator is a little suspect.

See examples at http://www.techonthenet.com/access/queries/like.php
Iulique
Hi,
Thank you for answering. I tried it also without the like but to no avail. I suspect is has something to do with adding a criteria to one of the fields that need updating.

Unfortunately all the other fields that may help me meet the criteria need to be updated at the same time.

I would prefer not to create a "third glass" query for fear of unnecesarily slowing the database down.

I just need to know why it does not parse the criteria.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.