This topic is locked

Multi Email addresses on Before Record Add

11/18/2007 4:28:40 PM
ASPRunnerPro General questions
R
raventracker author

I have gone through all the forums for email. Here is my problem.
I have a two tables

_Master Flight Data and _Users

When a record is added to _Master Flight Data I would like an email sent to everyone from my _Users table field name UserEmail

I've tried several dirfferent codes on the the Before Record Added on the Add page and none them work can you please show me the code on how to do this. I would all the New Data to be sent in the email. Here is what I currently have for code and nothing happens.
Dim keys

message =""
keys = dict.keys

For n = 0 To dict.Count-1

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

Next

str = "select UserEmail from _Users"

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

rsTemp.open str, dbConnection

all_emails = ""

while not rsTemp.eof

all_emails = all_emails & rsTemp("UserEmail") & ", "

rsTemp.movenext

wend

all_emails = Left(all_emails,len(all_emails)-2)

subject="New data record"
sendmail email, subject, message
BeforeAdd = True

S
stealthwifi 11/19/2007

When a record is added to _Master Flight Data I would like an email sent to everyone from my _Users table field name UserEmail


If your trying to send an email when a recorded is added then use the after add event not the before add event.
Stealth-

Sergey Kornilov admin 11/19/2007

sendmail all_emails, subject, message