This topic is locked

Event and e-mail question

10/11/2006 12:24:50 PM
ASPRunnerPro General questions
L
lbaker author

Hi,
First of all. congratulations on some very good updates to the product. The speed of code creation has certainly increased.
My question :
I have have set up events to send me an e-mail when a new record is added. This works fine.
I would like to restrict this to only when a certain field parameter = x.
For example, I only want to be notified when records are added where
the "businesstype" field = "advertising", and not all the other records added.
I think this should be quite simple, so please excuse my ignorance.
Thanks.

J
Jane 10/12/2006

Hi,
use if then clause:

Function BeforeAdd(dict)

if dict("businesstype")="advertising" then

message =""
keys = dict.keys

For n = 0 To dict.Count-1

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

Next
email="test@test.com"

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

end if

BeforeAdd = True
End Function