
January 29th, 2004, 08:43 AM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 16
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Insert into Two Tables in an Access Database
Trying to Insert into Two Tables in an Access Database
In the table tbl_Trans, I'm inserting the userid and an Autonumber is generating the TransID. If I hard code in the TransID then it works fine but I'm looking for the newly created TransID to relate to the TransID in tbl_Numbers
sql = "INSERT INTO tbl_Trans (UID) VALUES ('" & Request.Form("UID") & "')"
sqlb = "INSERT INTO tbl_Numbers (Num1, DrawID, TransID) VALUES ('" & Request.Form("num1") & "','" & Request.Form("DrawID") & "','" & "TRANS ID IN HERE" & "')"
Conn.Execute sql
Conn.Execute sqlb
Have a Select statement to Insert the relevant TransID but do I include it in the above sqlb or where does it go?
"SELECT TOP 1 TransID FROM tbl_Trans ORDER BY TransID ASC"
|