This topic is locked

Send e-mail when Adding/Editing record only if checkbox ticked

6/1/2009 4:09:46 PM
ASPRunnerPro General questions
jtksmith author

I have a two part question/problem. I would like to be able to send an email when a record is added or deleted. This is not a problem and is working. What I cannot figure out how to do is to only send the email if a checkbox on the Add/Edit form is ticked by the user. This way the user can choose whether or not to send an email after update. Then, after the email is sent, I would like the checkbox to be cleared so that the next time the record is updated, the user will agaom have the option whether or not to send the email.
To state it another way. I would like to 1) send an email when a record is Added/Edited, based conditionally on the status of a checkbox and 2) clear or reset the checkbox after the email is sent.
I've searched the forums but have not been able to find a solution to this problem.
I found a similiar topic that was started in 2005 but didn't seem to reach resolution. "Sending e-mail when a new record is added only if the user marks that"
Thank you.

J
Jane 6/2/2009

Jeremy,
you can check selected value in your event and send email if needed.

Here is a sample:

if values("FieldName")=1 then

'send email here

end if



Then update record manually:

str = "update TableName set FieldName=0 where KeyField=" & keys("KeyField")

dbConnection.Execute str



where FieldName and KeyField are your actual field names, TableName is your actual table name.