Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send an Email at a specific date.

Status
Not open for further replies.

GeoDM

Technical User
Dec 16, 2003
66
US
I have created a vbs file that will send an email using JMail. I have an Access database with a date field that has the date I would like the email sent. Is there some procedure in Access I can create that will look at the date field say once a day and if it finds todays date call the vbs file that sends the email? Or should I be looking a creating a VBS file that runs through an AT command that opens the Access database, looks for the date and sends the email? Thanks in advance for any help.
 
In the OnOpen event of your first form, you can add some code to compare the current date and the date you have to trigger the email.

If [YourDate] = Date() Then
Send email
End If

Depending on the format of your date field, you may want to format it in the above If statement. Or you could use the DateDiff function...

If DateDiff("d", [YourDate], Date()) = 0 Then
Send Email
End If
 
The problem is, and I should have stated this above, that the database is only accessed through ASP. No one ever opens up an Access Form. The code you supplied is close to what I have scratched out so that for including it.

I guess I need to be looking to create a VB Script that runs on a daily schedule that:

1) Opens the database and loops though the records looking for DateDiff("d", [YourDate], Date()) = 0.
2) If it finds it then execute the email.

I am hung up on how to open and loop through the database.

Thanks for responding!
 
Since you're using an ASP app, you can put the code into your Global.ASA file, in the Application_OnStart event procedure. This will ensure it's run only when the FIRST user opens the first page of the app.

You can search the ASP forum for tips on connecting to an Access database backend.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top