> 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192551 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=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54