lookup data and input Y or N in same table

K

Kentucky5

Below is the query I have setup and what this seems to be
doing is taking the codes out of the memo fields but it is
not updating the Codes field. What I am trying to do is
lookup in the two memo fields Comments and Technical if
they contain the codes I want to put a Y in the Codes
field, if they do not then I want to put a N in the Codes
field. I would also like to copy the code to another
field within the table, and if more than one code is found
put the second in another field. I have 4 additional
fields setup for this data.

Any help would be appreciated.

UPDATE
SET
.Comments =
.[Codes]="Y",
.Technical =
.[Codes]="Y"
WHERE (((
.Condition) Like "*PO*" Or
(
.Comments) Like "*P0*")) OR (((
.Technical)
Like "*PO*" Or (
.Technical) Like "*P0*"));
 
J

John Spencer (MVP)

Well, it is doing what you tell it to do. Perhaps you want

UPDATE

SET
.[Codes]="Y"
WHERE
.Condition Like "*PO*" Or
.Comments Like "*P0*" OR
.Technical Like "*PO*" Or
.Technical Like "*P0*"


But more likely you want

UPDATE

SET
.[Codes]=
IIF (
.Condition Like "*PO*" Or
.Comments Like "*P0*" OR
.Technical Like "*PO*" Or
.Technical Like "*P0*","Y","N")

Although, this may give you unexpected results if all three fields are NULL.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top