Steven, You can use the below query. This only works if TableA has an IDENTITY field. <cfquery> Insert into Table1 values('some','some') SELECT @@Identity as NewID </cfquery> JOe
-----Original Message----- From: Brian Scandale [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 16, 2002 3:16 PM To: CF-Talk Subject: Re: Inserting into 2 tables with a relationship I suggest using the custom tag... Max_ID from the Macromedia Custom Tag library. It is well documented. Then search the archives for discussions on use of the tag. I use this exclusively now and avoid AutoIncrementing primary key fields like the plague. hth Brian At 10:49 AM 5/16/02 -0500, you wrote: >I have a database with 2 tables one has a relationship with the other and >when I do an insert I need to insert into table 1 and insert into table 2 >with an var_id field that has not been generated until table 1 has been >inserted into.. I am not sure what to do or how to do it.. I am using CF 5 >and Access.. > >Steven Lancaster >Barrios Technology >NASA/JSC >281-244-2444 (voice) >[EMAIL PROTECTED] > > > ______________________________________________________________________ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists