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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using record number in query 1

Status
Not open for further replies.

VicBull

Programmer
Aug 8, 2001
13
0
0
GB
I need to create a unique reference number in a separate field which, suprisingly I have called URN

I require it to be in the series 90,000

Is it possible to use the record number to create a URN in the URN field using the query feature? ie 90,000 + 1 (90001) for the first record, 90,000 + 2 (90002) for the second record etc.

There are 20,000 records in the file.

There must be a simple way in which this can be done, perhaps I am getting too old to think of the obvious.

can anyone help?

Vic Bull
 
Create your URN number field in the table and run a script like this:

Code:
var
 RecNum number
 tc   tCursor
endvar

RecNum = 90000

tc.open(":work:myTable.db");your table name goes here
tc.edit()

scan tc:

   tc.Urn = RecNum
   RecNum = RecNum +1

endScan

tc.endEdit()
tc.close()



Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
PS - make the starting number 90001 instead of 90000 if that's what you want the first record to have as its unique number.

Mac :)

"There are only 10 kinds of people in this world... those who understand binary and those who don't"

langley_mckelvy@cd4.co.harris.tx.us
 
Thank you Langley

It worked just great

Vic Bull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top