Does sending an email trigger an event? (1 Viewer)

OBBurton

Registered User.
Local time
Today, 12:23
Joined
Dec 26, 2013
Messages
77
Hi all,

Many thanks again for all the kind and helpful responses to my many questions! I have yet another. I would like to set a flag when a report gets emailed. Is this possible?
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 20:23
Joined
Jul 9, 2003
Messages
16,393
Please show the code that sends your email
 

OBBurton

Registered User.
Local time
Today, 12:23
Joined
Dec 26, 2013
Messages
77
Actually my code only calls the preview of a report, where the user has the option to print or send an email. I only want to set the flag when he/she elects to send an email. But just in case you still need it:
Code:
    DoCmd.RefreshRecord
    DoCmd.Save acForm, "frmInvoice"
    DoCmd.OpenReport "rptInvoice", acViewPreview
    DoCmd.RunCommand acCmdZoom100
    Me.Visible = False
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 20:23
Joined
Jul 9, 2003
Messages
16,393
>>>when he/she elects to send an email<<<

Please explain this process.
 

OBBurton

Registered User.
Local time
Today, 12:23
Joined
Dec 26, 2013
Messages
77
Hi, Uncle Gizmo! Thanks for responding!
The code I posted above is from a command button on frmInvoice which opens rptInvoice in Print Preview. The user then has the option to print the report, email it or click on Close to return to frmInvoice. After printing or emailing it returns to Print Preview, where they can make another selection or click on Close to return to frmInvoice. I'm only interested in tracking whether or not an invoice has been emailed.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 20:23
Joined
Jul 9, 2003
Messages
16,393
>>>The user then has the option to print the report, email it or click on Close to return to frmInvoice<<<

Please explain the steps the user goes through when they decide to send the report via e-mail?
 

OBBurton

Registered User.
Local time
Today, 12:23
Joined
Dec 26, 2013
Messages
77
On the print preview there are (among others) are buttons for: Print which sends the report to your printer, Close Print Preview and email. When you click on the email button a list of formats comes up. There are a number of file formats to choose from, PDF being our first choice. When you click on the format of your choice an Outlook email form opens and you can enter an address in the To box and write a note in the message area. The formatted version of the report has already been inserted in the Attachment box. When you are finished you click on the Send button and you are returned to Print Preview. Normally at this point we would select Close Print Preview to return to frmInvoice.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 20:23
Joined
Jul 9, 2003
Messages
16,393
I don't have an e-mail button, this maybe because I do not use outlook at home. I do have a right click option to send to mail recipient.

I was hoping you had a button somewhere with an event that could be utilised.

The usual method of handling something like this is to take complete control of the process, not allowing the user access to the buttons or right click menu items. Force the user to use your form so that you have complete control over the process; then you would be able to flag when something happened.
 

OBBurton

Registered User.
Local time
Today, 12:23
Joined
Dec 26, 2013
Messages
77
Thanks!
Could I take complete control and still use the print preview? Or would I have to use the report view and add a send email button to the report? If I did it that way, is there a VBA function or command to create a PDF file?
 

spikepl

Eledittingent Beliped
Local time
Today, 21:23
Joined
Nov 3, 2010
Messages
6,142
Outlook has an event so you can tell whether a mail has been sent or just closed/dismissed For that you'd need to run the process through outlook. For mailing stuff via outlook there are trillions of posts here - use google. For the send event of Outlook - use googl it requres a bit of fiddling in outlook.

When sending from access using an outlook instance, i am not sure that you can tell from access without the bbenefit of th eoutlook send-event what the fate of the mail was.

BTW: Thanking people for asking you clarifying questions is IMHO a border line case between being polite and brown-nosing :D
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 20:23
Joined
Jul 9, 2003
Messages
16,393
I like to see politeness, being a Brit... A nice change from some of the down right rudeness.
 

OBBurton

Registered User.
Local time
Today, 12:23
Joined
Dec 26, 2013
Messages
77
Sorry, I just about thanked everyone, but I don't want to have anyone think I am brown-nosing, which I am not! I am just of the old school, where being thankful for others time is just good form. In the future I will try to keep my thank yous for complete resolution of my issues.
 

vbaInet

AWF VIP
Local time
Today, 20:23
Joined
Jan 22, 2010
Messages
26,374
Of course you can have event handlers for Outlook in Access but I'm not sure if handling event is even necessary.

If you want to simply set a flag after an e-mail is sent then it can be done without needing Outlook VBA. On the other hand, if you want to check whether an e-mail actually did send successfully then you need Outlook VBA.
 

OBBurton

Registered User.
Local time
Today, 12:23
Joined
Dec 26, 2013
Messages
77
Thanks!
I actually figured that out for myself, but I do appreciate the continued input. I'm using a command button to send the email and set the flag. It shows the email form before sending and you have to click the send button on the form to complete the process. So, you can be reasonably certain it has been sent. You can un-check the sent box on the main form if you abort, which is not likely to happen. That's good enough for me.
 

Users who are viewing this thread

Top Bottom