you can use max to do it

If its before you're inserting the record for the current user, just get the
last id number and add 1 to it

<cfquery name="getID" datasource="#travelDS#">
select MAX(id) as id_no
from forms
</cfquery>

<cfset trnumber=#getID.id_no# + 1>

is that what you wanted?

-----Original Message-----
From: Angel Stewart [mailto:[EMAIL PROTECTED]]
Sent: 27 September 2001 12:51
To: CF-Talk
Subject: Last Record's Autonumber value.


Hey all,

How can I tell what the Autonumber value of a record I just inserted is
using Access?

So I enter a User, and then I want to display that user's ID back to them. 
UserID is an Autonumber field, so I don't know it until after I insert. 
I can't search for First name or last name, because those could be
duplicated.

Do I do a Top 1 in a SQl query and wrap the entire thing in a CFTransaction?

-Gel


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to