SQL to execute updates one after another

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
 
M

Michel Walsh

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
 
M

Michel Walsh

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
 
C

Céline Brien

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
 

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