SQL to execute updates one after another

  • Thread starter Thread starter Céline Brien
  • Start date Start date
C

Céline Brien

Hi everybody,
A table of sales, data from an outside database.
In the field SMan, codes have to be change.
John is now reponsible of Ted and Paul territory.
I know how to create an update query.
But, I have at least 16 queries to do.
Can I use SQL codes to execute these update one after another ???
Thank you for your help,
Céline
--------------------------------------------------------
Sub UddateSMan

UPDATE Ventes SET Ventes.Vendeur = "JOH"
WHERE (((Ventes.Vendeur)="TED" Or (Ventes.Vendeur)="PAU"));
Next
UPDATE Ventes SET Ventes.Vendeur = "FRA"
WHERE (((Ventes.Vendeur)="MAR" Or (Ventes.Vendeur)="BAR"));
Next

End sub
 
Hi,


Do it in just ONE query....
Have a table like:

Modifs ' table name
Was, NewRes 'fields name
TED JOH
PAU JOH
MAR FRA
BAR FRA
.... data


then, make a back up, and launch the single simple query that follows:


UPDATE Ventes INNER JOIN Modifs ON Ventes.Vendeur=Modifs.Was
SET Ventes.Vendeur = Modifs.NewRes





Hoping it may help,
Vanderghast, Access MVP
 
Hi,


Do it in just ONE query....
Have a table like:

Modifs ' table name
Was, NewRes 'fields name
TED JOH
PAU JOH
MAR FRA
BAR FRA
.... data


then, make a back up, and launch the single simple query that follows:


UPDATE Ventes INNER JOIN Modifs ON Ventes.Vendeur=Modifs.Was
SET Ventes.Vendeur = Modifs.NewRes





Hoping it may help,
Vanderghast, Access MVP
 
Hi everybody,
Hi Michel,
Super !
I should have think of it !
And so easy if you have to had a NewRes !
Thanks a lot,
Céline
 
Back
Top