Something like:

<cfquery name="GetUserID" ...>
Select Max(UserID) as NewUserID from ...
</cfquery>

<cfoutput>Your user ID is #GetUserID.NewUserID#</cfoutput>

Of course you really should wrap a transaction around the above code and also have the 
db insert within the transaction as well.

HTH,

Howie Hamlin - inFusion Project Manager
On-Line Data Solutions, Inc. - www.CoolFusion.com
631-737-4668 x101
inFusion Mail Server (iMS) - The Intelligent Mail Server
>>> Find out how iMS Stacks up to the competition: 
>http://www.coolfusion.com/imssecomparison.cfm

----- Original Message ----- 
From: "Angel Stewart" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, September 27, 2001 7:50 AM
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
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.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