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!

onLoad Event

Status
Not open for further replies.

sync123

Programmer
Jul 20, 2003
32
US
Hi,

I have a form that users use to input information into a table. I created a field in my table called id this is the primary key. I want this id to start from 10,000 and keep incrementing everytime a new record gets stored.

I didn't want to mess around with auto number.
This is how I am thinking I could do this...

On the form onLoad event I initialize this global variable lastRecId to be 10,000 if there are no records in my table.

If the table is not empty obtain the unique id from the last record in the table and set lastRecId to this value + 1. Everytime you do an insert into the table increment lastRecID by one.

Would this work ?
Sync123
 
maybe another idea on this would be to use the newrecord property? if it's a new record then get the number
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top