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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending E-mail

Status
Not open for further replies.

mpat

Programmer
Feb 23, 2005
4
US
One of my buttons user presses sends out an e-mail but i want to delay the actual sending of the e-mail with the date from a field in the form the user inputs value into it.

any idea how i can capture the send date since all this is done in access, but threw outlook, i was not sure if its possible to do but i think it should be.
 
mpat,

It would seem more logical for the program and user to disable the Send button until the date field on the form has been completed.

Or are you saying that you want to send the email on a date retreived from the database.

regards Hugh
 
Ok, i think your second option seems more along the lines of where i am trying to go. But essentially the form on a DB is data entered for ex: today. and one of the fields in the form is a date field of when the e-mail should go out and there is a e-mail button also on the same field. So what should happen is when a user inputs all the data in the form and then selects the e-mail button- the code should search for that data field and use that date field to send out that e-mail. But i looked in outlook and even there is seems to be a difficult task. Maybe i can dump the data into a table and run some kind of daily auto process. Let me know if i have confuses you! Thanks!
 
mpat,

I think a daily task to determine which emails to send "today" is probably going to be the best approach.

regards Hugh
 
Ok, i have a question other then the e-mail deal. Is it possible that when my user selects the E-mail button, behind the sceens the code will also create a new task in outlook and save it based on a date from the form with the e-mail button.

Ex: User inputs data in a form (i.e. Date to nofity) and then selects the e-mail button. Then the user checks the tasks in outlook. and See a task create based on values from the form the user just completed.

Let me know if you have any other suggesstions.
Thanks!
Mpat
 
HI mpat,

along with the MailItem you create, you could also create an new TaskItem.

Check it out (TaskItem) on the Object Browser of Outlook.
You 'll get through easy, I think.
 
Hello, I did something along those lines once. The user entered the email information on a form. The form information was appended to a table, which had a yes/no field.

Emails were sent based on the records were checked. It was a manual process (sending the emails).

Would be easy enough to automate a process like that though.

The advantage at the time was that all the emails were saved in a table for easy retrieval.


 
If you want to delay sending of the mail use the DeferredDeliveryTime property of the mail item

Code:
Sub DelayMail()
 
 Dim olApp As Outlook.Application
 Dim olMail As Outlook.MailItem
 Set olApp = New Outlook.Application
 Set olMail = olApp.CreateItem(olMailItem)
 'set send time
 olMail.DeferredDeliveryTime = "2/28/2005 11:02 AM"
 'show mailitem. Not necssary just for demo purposes
 olMail.Display
 
End Sub
HTH,

Sam
For tsunami relief donations
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top