Question : Sql question for Access

I have the following query:

UPDATE LSInvoice SET LSInvoice.UPC = "99999900202030"
WHERE (((LSInvoice.UPC)="076711005351"))
SET LSInvoice.UPC = "99999900202029"
WHERE (((LSInvoice.UPC)="076711005344"))
SET LSInvoice.UPC = "99999900202031"
WHERE (((LSInvoice.UPC)="076711005368"))
SET LSInvoice.UPC = "99999900202032"
WHERE (((LSInvoice.UPC)="076711005375"));

That gives me a syntax error missing operator. What have I done wrong?

Answer : Sql question for Access

You can only update one value at a time if you are trying to do multple where clauses, or you could use nested IIF( ) function calls or you could use the switch function:

UPDATE LSInvoice
SET LSInvoice.UPC = Switch(LSInvoice.UPC="076711005351", "99999900202030",
                                             LSInvoice.UPC="076711005344", "99999900202029",
                                             LSInvoice.UPC="076711005368", "99999900202031",
                                             LSInvoice.UPC="076711005375", "99999900202032")
WHERE LSInvoice.UPC IN ("076711005351", "076711005344", "076711005368", "076711005375")
Random Solutions  
 
programming4us programming4us