Trigger email

C

carlos24mar

Is there a way that you can have a countdown and when the countdown reaches 0
for it to automaticly send out a email to a certian person?
 
J

Jackie L

You will first have to determine how you are going to calculate your
countdown. Then try the following:

Dim strSubject As String
Dim strAddress As String
Dim strMessage As String
Dim blSendEmail as Boolean

strSubject = "Countdown reached zero"

strMessage = "This is the message that will be the body of the email."

If 'This is where you would put the countdown check value' Then
strAddress = Me.EmailAddress 'address field on form
blSendEmail = Outlook_SendEmail(strSubject, strAddress,
strMessage)
Else
Exit Sub
End If



Hope this helps,
Jackie
 
C

carlos24mar

Thank you Jackie,

I guess I should have stated that I am a beginer with Access. I don't know
where to type all that info at. I am assuming that it goes in the visual
basics.
 
J

Jackie L

Carlos,

Start with creating a query which would have your criteria for reaching
zero, like a Totals Query which would total the amount. So, if your query is
called qryFindAmount and the field in the query is called TotalAmount then,
in the code listed below for the "IF" statement put:

If DMax("TotalAmount","qryFindAmount")= 0 then

You will also need a field for the email address. In the code example
below, I called the field EmailAddress. This field needs to be on your form
or referenced in a query.

Then, on your form, either on the After Update event of a field (like your
quantity field), or on a button, click on the drop down and pick [Event
Procedure], then copy the code listed below with the correct query
information as shown above and paste in your Visual Basic window.

If you set up the format of your query and the field name for your Email
address, I can help with more specifics.

Jackie
 
Top