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

Access Autonumber

Status
Not open for further replies.

TheSponge

Technical User
Jul 2, 2003
442
GB
Hi there,
My database is a returned goods database, it has a logID as the primary key (AUTONUMBER). What I need is a text box and a button called "Create RMA" that when clicked access creates another autonumber and stores it in the text box for that record.

Then if an RMA number is needed for another record say record 56, you can click "create RMA" again, and access creates the next autonumber in sequence for that record..

Not sure if I need a seperate table for the RMA or how to even create the code for this operation.

Hope you understand...

Thanks

JAMES
 
You don't need any code. Just set up your RMA table with a field whose type is "AutoNumber". Whenever you add a new record to the table, Access will generate the next value in sequence as the value of that field.

You can retrieve the number of the last one created with some SQL like

Select MAX(NumberField) As [LastNumber] From RMA
 
... but be aware that a 'busy' data base may (WILL) occassionally fail to return the correct value in the scenario described. (Busy) Multi-User systems often have problems using the integer version of "AutoNumber", as the number is obtained/retrieved as soon as the new ("tenative") record is created, but not actually included in the db until the record is committed. See faq700-154 for a version which overcomes this -to some degree.




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
MichaelRed
The FAQ that you gave is something about "Setting up partitioning for installing Linux". Is that what you intended?
 
sorry, a bit of a type / fumble fingers faq700-184




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Thanks guys,

The other thread was very useful. Its doing what I want now..

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top