This topic is locked

Email Table Events?

4/7/2006 10:36:22 PM
ASPRunnerPro General questions
Lowkeck authorDevClub member

Is it possible to have an email table event that will send an email to the corresponding email address that is atored in the database? Is it also possible to include information from the databse in the email?

Sergey Kornilov admin 4/10/2006

you can do it using events.

Select Sent email with new data action for Before record added event on the Events Tab and make some changes in code:

Function BeforeAdd(dict)

message =""

keys = dict.keys

For n = 0 To dict.Count-1

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

Next

email=dict("email")

subject="New data record"

sendmail email, subject, message

BeforeAdd = True

End Function



where email is your current field name where email address is stored.

Lowkeck authorDevClub member 4/10/2006

Will this work if the email field is located in a seperate table from the table I am adding the record?

Sergey Kornilov admin 4/10/2006

This example works when email field is located in the same table.
If it's located in another table run SQL query to retrieve data from another table and build email body. See sample events for more info.