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

Using AUTONUMBER as a CF variable

Status
Not open for further replies.

fusionaire

Programmer
May 20, 2000
67
US
I have a shopping cart Application in which I have to set a field called "salenumber" to the value of AUTONUMBER. I have AUTONUMBER set up as my Primary key because the user enters multiple order amounts into the database. How can I query the value(AUTONUMBER) from the Access db for CF?
 
As the record has not been added yet, you cannot get the value of the primary key as this is created by a trigger during insert.<br>The only thing you can do is count the max value of the primarykey column currently and add one to it (select max(column) as maxval from table), which will be it's next value when you insert the record.<br>Of course you have to make sure no-one can insert a record during this process by using CFLOCK and CFTRANSACTION around your code.<br><br> <p>Russ Michaels<br><a href=mailto:russ@satachi.com>russ@satachi.com</a><br><a href= Internet Development</a><br>Rapid Web application development, specialising in Coldfusion, database integration and e-commerce solutions.
 
Thanks, that's what I needed. <br><br>PS~<br>I liked your site
 
What is the code that I would use to insert that value into a field that is already populated?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top