Anyone have an idea on this one.
I have a form where a user enters in some fields on the add page and picks a user to send to . One of the fields an email_tofield ( auto populated from another users table lookup and auto populates email field ) . What I'm trying to do is sendmail to the email address of the field ( email_to) that was added to the record .
Here is my After record added code
' Parameters:
' dict - Scripting.Dictionary object.
' Each field on the Add form is represented as a 'Field name'-'Field value' pair
'** Custom code ****
' put your custom code here
str = "select * from messages where Userid='" & Session("UserID") & "'"
Set rsTemp = server.CreateObject("ADODB.Recordset")
rsTemp.open str, dbConnection
Session("slsm_name")= rsTemp("slsm_name")
Session("to_email") = rsTemp("to_email")
Session("email_from") = rsTemp("email_from")
Session("Subject") = reTemp("Subject")
Dim dkeys
message =""
dkeys = dict.keys
For n = 0 To dict.Count-1
message = message & dkeys(n) & " : " & dict(dkeys(n)) & vbcrlf
Next
' Instead of "test@test.com"
[font=Arial Black]subject="New Message" & rsTemp("Subject") 'Instead of "New Message"
sendmail email, subject, message
rsTemp.close : set rsTemp = nothing
BeforeAdd = True
' set BeforeAdd to True if you like to proceed with adding new record
' set it to False otherwise
The record gets added but the email does not go . No error message