Condition Based Email with Linked Table Fields |
2/10/2009 5:09:24 PM |
ASPRunnerPro General questions | |
![]() <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=10883&image=1&table=forumtopics' class='bbc_emoticon' alt=':blink:' /> Greetings, ASPRunnerPro Forum. This is my first posted question. set rsOld = dal.ReportStatus.Query(where,"")
message = message & vbcrlf & "Client: " & vbcrlf & dict("Client") & vbcrlf
|
|
J
|
Jane 2/13/2009 |
Hi, if oldvalues("ReportStatus")<>dict("ReportStatus") and dict("ReportStatus")="Closed" then email="me@mycompany.com" subject="Report Closed" message = message & vbcrlf & "Report Status: " & vbcrlf & dict("ReportStatus") & vbcrlf message = message & vbcrlf & "Closed Date: " & vbcrlf & dict("DateClosed") & vbcrlf message = message & vbcrlf & "Notes: " & vbcrlf & dict("Notes") & vbcrlf str = "select Client, Project from TableA where RecordID_A=" & dict("RecordID_B") Set rstmp = server.CreateObject("ADODB.Recordset") rstmp.open str,dbConnection message = message & vbcrlf & "Client: " & vbcrlf & rstmp("Client") & vbcrlf message = message & vbcrlf & "Project: " & vbcrlf & rstmp("Project") & vbcrlf rstmp.close set rstmp=nothing sendmail email, subject, message end if |
![]() |
jtksmith author 2/15/2009 |
Thank you Jane, your response was helpful. For some reason it didin't want to work exactly that way and I kept getting a SQL query error about a Syntax Error and a missing operator. Sorry, I didn't save the error. Your response did inspire me so I played around with it and tried something slightly different. Since I already had a "Save old data record in another table" event on the same form, I tried moving the "rsFields.close: set rsFielgs=nothing" below my send email event and changed and it worked. Here is my code now: |
![]() |
jtksmith author 2/15/2009 |
Jane, |