Generating Automatic Email, Based on a Criteria!!! (1 Viewer)

O

omoregbe

Guest
Hi people,

Can anyone generate a code for this task.

table fields: customer name, staff name, staff email, last visit (date) & next visit (date).

I have also created the form based on the table, but no functions or commands in it.

I want an email notification to be sent to the staff reminding them of their next visit.

I think you would need to use the 'If' criteria to compare the next visit (date) & current date (now()), and they have to be equal before the email can be fired to the staff.
But i don't really know how, I have tried different examples here, but they don't seem to work for me. :confused:

Please anyone, i desperately need your help. Anything at all.

Thank you in advance

Nick
 
Last edited:

jatfill

Registered User.
Local time
Today, 06:27
Joined
Jun 4, 2001
Messages
150
I'm sure we can work this out pretty easily, but first take a step back and look at what exactly you want to accomplish. Is this an automated function you want to run every time your criteria is met, or do you wan to execute it manually & compare the dates at that point?

If this is an automatic function then you will probably want to create a module to handle the date comparison & send a reminder based on that. The planning is the important part here, the code is relatively simple once you come up with a plan.

In the meantime, Talismanic/BukHix has several great posts on email functions that would help tremendously with the SendObject command. You will basically just need to evaluate your date information from the form and then act if your criteria is met:

Code:
If datefield = Date() Then
      'Send Command Here
      DoCmd.SendObject(objecttype, objectname, outputformat, to, cc, bcc, subject, message, editmessage, templatefile)
End If
The above can be used as the code behind a button. It's a cryptic example, but hopefully that will get you started on the right track. Good Luck!
 

Users who are viewing this thread

Top Bottom