This topic is locked

email SUBJECT = Master Record name

1/22/2010 4:19:25 PM
ASPRunnerPro General questions
M
mgill2525 author

Simply out I have a table called "dbo.tbl_Connections" with JobID and JobName. I have a detail table with JobID and Comment. Whenever someone adds a new comment I would like an email to be sent with the JobName as the Subject line. I have everything working, TO: FROM: and MESSAGE: but cannot figure out how to code for the subject line to populate with the MasterTable JobName. Here is the code I am using.
Dim dkeys

message =""
dkeys = dict.keys

For n = 0 To dict.Count-1

message = message & dkeys(n) & " : " & dict(dkeys(n)) & vbcrlf

Next
email="mgill@aol.com"

subject=SESSION("dbo.tbl_Connections_masterkey2")
sendmail email, subject, message

J
Jane 1/26/2010

Hi,
to select JobName from master table use following code:

str = "select JobName from dbo.tbl_Connections where JobID=" & SESSION("dbo.tbl_Connections_masterkey1")

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

rstmp.open str,dbConnection

subject=rstmp("JobName")

rstmp.close

set rstmp=nothing
M
mgill2525 author 1/26/2010



Hi,
to select JobName from master table use following code:

str = "select JobName from dbo.tbl_Connections where JobID=" & SESSION("dbo.tbl_Connections_masterkey1")

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

rstmp.open str,dbConnection

subject=rstmp("JobName")

rstmp.close

set rstmp=nothing



_____
Sorry to seem so dense - but where exactly do I put this code?

J
Jane 1/27/2010

Add this code just before your code:

str = "select JobName from dbo.tbl_Connections where JobID=" & SESSION("dbo.tbl_Connections_masterkey1")

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

rstmp.open str,dbConnection

subject=rstmp("JobName")

rstmp.close

set rstmp=nothing

Dim dkeys

message =""
dkeys = dict.keys

For n = 0 To dict.Count-1

message = message & dkeys(n) & " : " & dict(dkeys(n)) & vbcrlf

Next
email="mgill@aol.com"
sendmail email, subject, message