> OK it'll work, but what happens if you have a few concurrent users and one
> thread (or process.. CMIIW) has ran the insert query, but before the > thread get's the chance to do another query to get the max id out, another > thread has inserted a record. Seems to me that the last record would be the last record no matter when it was entered... It's access people... how much concurrent traffic do you think it's going to get? Do you honestly see threads getting crossed? I see the data source crashing more often than that. Hell, I probably have a better chance of hitting the lotto. > Might as well do it right in the first place.... What's "right" for one application is quite possibly overkill for another. Did I mention it was access? **ducks** -----Original Message----- From: COLLIE David [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 01, 2005 10:13 AM To: CF-Talk Subject: RE: EASY: grabbing the id of a newly created item.. > Wow, too much for so little, Just use Richard's method > > RUN YOUR INSERT QUERY > > Then directly after the insert get the records ID... > > <cfquery name="mid" datasource=""> > SELECT MAX(TheID) as LatestID FROM TABLENAME > </cfquery> Sorry but have to chime in here rather than lurking.... OK it'll work, but what happens if you have a few concurrent users and one thread (or process.. CMIIW) has ran the insert query, but before the thread get's the chance to do another query to get the max id out, another thread has inserted a record. This then means that when you try and get the max ID for the first thread out you'll actually be retrieving the second thread's ID meaning that all FK's etc after that would just be plain wrong. Then the question will be... 'How come my user's are seeing other people's data' Might as well do it right in the first place.... There are plenty of suggestions for doing this in previous messages in the thread(s) covering this. -- dc ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192563 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

