Update Query Question

  • Thread starter NeonSky via AccessMonster.com
  • Start date
N

NeonSky via AccessMonster.com

Good Afternoon,

Wow I am surprised I am having so much trouble with something that is so
simple...perhaps you can tell me if what I am trying to do is even possible.
I would like to do multiple updates within a single query, can I establish
something similar to the "logic" below? Thank you!

UPDATE tblWeeklyBase
SET tblWeeklyBase.CONVERTED1 = "Daily"
WHERE (((tblWeeklyBase.CCODE)="D")),
SET tblGRCWeeklyBase.CONVERTED1 = "Occupy"
WHERE (((tblGrcWeeklybase.CCODE)="LD"));
 
K

KARL DEWEY

I do not think it will work with two WHERE statements and you have two
different tables - tblGrcWeeklybase and tblWeeklyBase.

How are they related?

If it was one table then I think you could use an IIF statement.
 
N

NeonSky via AccessMonster.com

Hello Karl how careless of me... please consider the correct sample text.
Thank you!

UPDATE tblWeeklyBase
SET tblWeeklyBase.CONVERTED1 = "Daily"
WHERE (((tblWeeklyBase.CCODE)="D")),
SET tblWeeklyBase.CONVERTED1 = "Occupy"
WHERE (((tblWeeklybase.CCODE)="LD"));




KARL said:
I do not think it will work with two WHERE statements and you have two
different tables - tblGrcWeeklybase and tblWeeklyBase.

How are they related?

If it was one table then I think you could use an IIF statement.
Good Afternoon,
[quoted text clipped - 8 lines]
SET tblGRCWeeklyBase.CONVERTED1 = "Occupy"
WHERE (((tblGrcWeeklybase.CCODE)="LD"));
 
D

Douglas J. Steele

UPDATE tblWeeklyBase
SET CONVERTED1 =
Switch([CCODE] & " ='D'", "Daily", [CCODE] & " = 'LD'", "Occupy")
WHERE tblWeeklyBase.CCODE IN ("D", "LD")


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


NeonSky via AccessMonster.com said:
Hello Karl how careless of me... please consider the correct sample text.
Thank you!

UPDATE tblWeeklyBase
SET tblWeeklyBase.CONVERTED1 = "Daily"
WHERE (((tblWeeklyBase.CCODE)="D")),
SET tblWeeklyBase.CONVERTED1 = "Occupy"
WHERE (((tblWeeklybase.CCODE)="LD"));




KARL said:
I do not think it will work with two WHERE statements and you have two
different tables - tblGrcWeeklybase and tblWeeklyBase.

How are they related?

If it was one table then I think you could use an IIF statement.
Good Afternoon,
[quoted text clipped - 8 lines]
SET tblGRCWeeklyBase.CONVERTED1 = "Occupy"
WHERE (((tblGrcWeeklybase.CCODE)="LD"));
 
Top