Update +1

  • Thread starter Thread starter LJG
  • Start date Start date
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
 
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
 
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
 
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
 

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

Back
Top