This topic is locked

Email Selected Records

10/26/2013 2:10:48 AM
ASPRunnerPro General questions
lefty author

I have an email button setup on one table works fine see 2 examples below. Asprunner 7.2 , Access.

dim arr,I, currentTable, email_list, body, message, rmail, arr2, data
currentTable = "Main"
if keys.Count>0 then
body=""

email_list=""
set rmail=CreateDictionary()
for i=0 to keys.Count-1
arr=split(keys.Item(i)("ID"),"&")
if asp_count(arr)>=0 then
set arr2=CreateDictionary()
arr2("ID")=asp_urldecode(arr(0))
where = KeyWhere(arr2,"")
set data = dal.Table(currentTable).Query(where,"")
body=body & "Player: " & data("fldlast") & vbcrlf
body=body & "Tee Time: " & FormatDateTime(data("fldtime"),4) & vbcrlf
body=body & "Draw #: " & data("fldrandom") & vbcrlf
body=body & "Round Date: " & data("flddate") & vbcrlf
body=body & "Quota: " & data("start_quota") & vbcrlf
body=body & "Cup Points: " & data("cuppts_start") & vbcrlf
body=body & "-------------------" & vbcrlf
if data("fldemail")<>"" then
email_list=email_list & data("fldemail") & ","
end if
data.close
set data=nothing
end if
next
if email_list<>"" then
email_list = left(email_list,len(email_list)-1)
end if
rmail("to")=email_list
rmail("subject")="Whitney Group Pairings & Quota"
rmail("body")=body
rmail("message")=message
set arr = runner_mail(rmail)
result("txt") = "Emails were sent."
' if error happened print a message on the web page
if arr("mailed") then
errmsg = "Error happened:
"
errmsg = errmsg & "File: " & arr("source") & "
"
errmsg = errmsg & "Line: " & arr("number") & "
"
errmsg = errmsg & "Description: " & arr("description") & "
"
result("txt") = errmsg
end if
end if

result("txt") = params("txt") & " Sent"
Now On another Table__



This does not function !!!!!!!

dim arr,I, currentTable, email_list, body, message, rmail, arr2, data
currentTable = "Road_Cup"
if keys.Count>0 then
body=""

email_list=""
set rmail=CreateDictionary()
for i=0 to keys.Count-1
arr=split(keys.Item(i)("ID"),"&")
if asp_count(arr)>=0 then
set arr2=CreateDictionary()
arr2("ID")=asp_urldecode(arr(0))
where = KeyWhere(arr2,"")
set data = dal.Table(currentTable).Query(where,"")
body=body & "fldlast" & data("fldlast") & vbcrlf
body=body & "Date Played: " & data("flddate") & vbcrlf
body=body & "Frozen Quota: " & data("start_quota") & vbcrlf
body=body & "+ / - : " & data("updown1") & vbcrlf
body=body & "Date Played: " & data("flddate2") & vbcrlf
body=body & "+ / - : " & data("updown2") & vbcrlf
body=body & "Date Played: " & data("flddate3") & vbcrlf
body=body & "+ / - : " & data("updown3") & vbcrlf
body=body & "Total +/-" & data("Total_Up_Down") & vbcrlf

body=body & "-------------------" & vbcrlf
if data("fldemail")<>"" then
email_list=email_list & data("fldemail") & ","
end if
data.close
set data=nothing
end if
next
if email_list<>"" then
email_list = left(email_list,len(email_list)-1)
end if
rmail("to")=email_list
rmail("subject")="Just Testing"
rmail("body")=body
rmail("message")=message
set arr = runner_mail(rmail)
result("txt") = "Emails were sent."
' if error happened print a message on the web page
if arr("mailed") then
errmsg = "Error happened:
"
errmsg = errmsg & "File: " & arr("source") & "
"
errmsg = errmsg & "Line: " & arr("number") & "
"
errmsg = errmsg & "Description: " & arr("description") & "
"
result("txt") = errmsg
end if
end if

result("txt") = params("txt") & " Sent"
Checked Fields and Key fields . Everything is correct .

2nd example above does not send . Totally puzzled by this.

Have worked on this for hours.

Anybody see anything here?

admin 10/26/2013

I don't think it's possible to provide a meaningful advice just by looking at this code.
Step 1: make sure that syntax is correct. Use syntax checker in ASPRunnerPro for this purpose
Step 2: if syntax is correct check for any errors produced by this code in run time. Here is an article with step by step instructions on troubleshooting buttons:

http://xlinesoft.com/blog/2012/05/16/troubleshooting-custom-buttons-in-phprunner-and-asprunnerpro-applications/
Once you figure out the error message you can see what line of code produces this error and fix it.