This topic is locked

Send an email with fields from Parent and child tables

12/10/2011 12:28:41 AM
ASPRunnerPro General questions
W
Wallaroo author

Hi
I am trying to create an "After Add" event where a simple email is sent containing fields from both a parent and child table after a new record is added.
As I am new to this coding business, I would be grateful for any help to correct my coding attempt below!
set rstemp = Server.CreateObject ("ADODB.Recordset")

rstemp.open "select
from tblRecord where id=" & rs("AnimalID"), dbConnection

Dim dict

Set dict = values
Dim dkeys, tmpDict, msg, n

msg ="Species: " & rstemp("Species")

msg = msg & "Acquistion/Disposition: " & dict("InventoryType") & vbcrlf

msg = msg & "Type: " & dict("InventoryDescription") & vbcrlf

msg = msg & "Another email to add to your collection!"

rstemp.close
set tmpDict = CreateObject("Scripting.Dictionary")

tmpDict("to")="john@test.com"

tmpDict("subject")="New Record Added"

tmpDict("body")=msg

set ret=runner_mail(tmpDict)

if not ret("mailed") then

response.write ret("message")

*
In a nutshell, I want to include the field "Species" from the parent table and other selected fields from the child table. The link field in the master table is called "ID" and "AnimaldID" in the child table.
Thanks in advance for any suggestions!