This topic is locked

Master Table Question

9/9/2004 10:18:25 AM
ASPRunnerPro General questions
swat author

admin-
how can I copy a data field from master table to my detail table? What I am looking for is similar to OwnerID. User will enter a data into master file and I would like to copy that datafield into my detail table.
thx

Sergey Kornilov admin 9/10/2004

This happens automatically when you add a new record to the details table. Just make sure Foreign Key field don't appear on the ADD page.

swat author 9/10/2004

admin-
My question is how I can copy some of my data from master table to detail table?

Let see here:
Master table fields:

name

lastname

phone

pic
Detail table fields:

name (insert from master)

lastname (insert froim master)

fax

address
thx

Sergey Kornilov admin 9/13/2004

Swat,
you can store some field values from master table in Session variables and use these values when you add a detail record.

swat author 9/13/2004

admin-
could you give me an example ? thank you <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=2478&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />

Sergey Kornilov admin 9/13/2004

Sorry, I don't have any ready-to-go examples to copy data from master table to details.

swat author 9/22/2004

Here is the solution for data transfer from Master table into Detail table:
<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=2520&image=1&table=forumreplies' class='bbc_emoticon' alt='B)' />

<%

set dbConnection = server.CreateObject ("ADODB.Connection")

dbConnection.ConnectionString = strConnection

dbConnection.Open

Call ReportError
dbConnection.Execute "UPDATE Detail_Table INNER JOIN Master_Table

ON Detail_Table.Key = Master_Table.Key

SET Detail_Table.Name = Master_Table.Name"
dbConnection.Close

%>