Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update field with incrementing numbers

Status
Not open for further replies.

crystalhelio

Programmer
Apr 2, 2007
2
US
Hi,
I've a stupid question. i know this should be easy, but I can't figure it out. Please help.

I am using Dbase 4. I would like to run a query/macro to increment (i.e number it from 1.....100, if there are 100 records) the records in a field like we do in worksheet. Any idea?

Thanks
Ann
 
My trick is in the query to create a extra numberic field
and into table sqltable
next line after the query is
select sqltable
replace all extrafield with recno()



David W. Grewe (Dave)
 
Thanks David. But my problem ( I am sorry I didn't explain right) is aggravated as I resorted the data based on 2 other fields and now I want to renumber this sort order starting from 1 to 16760 in a sequential ascending order.

Any thoughts?

Thanks again
Ann
 
Add the extrafield in the sort as above.
after the SQL Statement

use SQLTABLE
lnCount=0
scan all
lnCount=lnCount+1
Replace EXTRAFIELD with lnCount
endscan


David W. Grewe (Dave)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top