My 2 cents worth.  To create a unique number for say purchase orders do the
following.
1.  Create a table with 2 fields.  One is auto incrementing.  Seed the auto
incrementing field or start with the default of 1 if it fits your needs.
The second field holds a lookup key...  More on that in a moment...
2.  When you need a new PO Number, insert a row in the table with a unique
lookup key.  With CF you could produce a UUID or roll your own.
3.  Select the row you just created using the lookup key.  Read the value in
the auto incrementing field and you have your new PO Number.
4.  Delete the row from the table using the lookup key.  This makes the
process run really fast, because the table can never contain more rows than
the number of concurrent people creating a PO at the same moment in time.

I have seen some SQL code that tries to guarantee that you can increment a
number inside the SQL statement, but have not fully tested to assure that it
works in all cases with an unlimited number of users.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 02, 2000 12:55 PM
To: [EMAIL PROTECTED]
Subject: Getting Key Field after Insert


I am using Microsoft Access Autonumber to create Key fields for me.

1.  Is this a wise thing to do?
2.  If  ok , anyone have  a nice way of getting the key back.  I am
currently
saving a temporary key in one the fields, then finding and changing.  This
seams like a lot of work to create an Insert.
3.  If not, and this might explain all of the discussion about key creation,
what was the consensous on the best way to generate a unique key?

Thanks,
Andy
----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to