Update +1

L

LJG

I am needing to update a table with field name custNumber. I have 11,000
records and need to update this field with a number each updated by 1

Can anyone tell me how I create the query to run that routine

TIA
 
M

Michel Walsh

Hi,


If you have no index not allowing duplicated value (or primary key) on
custNumber, then


UPDATE tableName SET custNumber=custNumber + 1



Hoping it may help,
Vanderghast, Access MVP
 
M

Michel Walsh

Hi,


If you have an index not allowing duplicated values, or if custNumber is the
primary key, first, create a query like:


SELECT custNumber FROM myTable ORDER BY custNumber DESC


say that query is saved under the name Q1. Then, use


UPDATE q1 SET custNumber = 1+custNumber



That is assuming you use Jet (or a dot mdb file, if you prefer).


Hoping it may help,
Vanderghast, Access MVP
 
L

LJG

Cool,

Thanks for that, problem solved

Les

Michel Walsh said:
Hi,


If you have an index not allowing duplicated values, or if custNumber is
the primary key, first, create a query like:


SELECT custNumber FROM myTable ORDER BY custNumber DESC


say that query is saved under the name Q1. Then, use


UPDATE q1 SET custNumber = 1+custNumber



That is assuming you use Jet (or a dot mdb file, if you prefer).


Hoping it may help,
Vanderghast, Access MVP
 
Top