You can simply do a select on the first 'id' if your query is ordered 
correctly, like:

 

Select top1 id

from table

order by id desc

 

Or there may be a function in access to return the latest ID. In MS SQL and 
MySql there are similar functions such as:

 

SELECT LAST_INSERT_ID() AS lastInsertID FROM mytable

 

Simply do another insert on the second table then.



Shaun McCran
 
T:  07792 783 184
E:  sh...@mccran.com
W: www.mccran.co.uk


 



To: flexcoders@yahoogroups.com
From: johndoemat...@yahoo.com
Date: Fri, 3 Apr 2009 07:38:11 +0000
Subject: [flexcoders] database question





hi i know this is not a flex question but is related to flex anyway. i have an 
access database with two tables A and B. the two are related in that the 
primary key of A(which is autonumber) is related to the foreign key in B. not i 
would like that when i insert data in the two tables A and B the foreign key of 
B is set to equal to the auto generated Primary key of A. How can i do this 
with coldfusion. i dont wanna do it in access itself but in the coldfusion 
query. thanks









_________________________________________________________________
Share your photos with Windows Live Photos – Free.
http://clk.atdmt.com/UKM/go/134665338/direct/01/

Reply via email to