This topic is locked

Default Value from Master Table

8/21/2008 11:07:57 PM
ASPRunnerPro General questions
S
surfermac author

What is the best way to have some or all records carry over to the "Child Page"? For example - I have a users table with a ParentID and when i create an users that is related to the parent i want most if not all the data to carry over as default.
Thanks

J
Jane 8/22/2008

Hi,
you can select field values from master table in the List page: Before process event on the Events tabm save it in the session variables and then use it as default values on the"Edit as" settings dialog on theVisual Editor tab.

Here is a sample code of List page: Before process event:

if request.querystring("masterkey1")<>"" then

str = "select Field1,Field2 from MasterTableName where RecordID=" & request.querystring("masterkey1")

Set rstmp = server.CreateObject("ADODB.Recordset")

rstmp.open str,dbConnection
if not rstmp.eof then

Session("Field1") = rstmp("Field1")

Session("Field2") = rstmp("Field2")

end if
rstmp.close

set rstmp=nothing

end if