Access creating Emails from stored data.. (1 Viewer)

StuartG

Registered User.
Local time
Today, 15:56
Joined
Sep 12, 2018
Messages
125
Hello all.

You may have seen posts from me previously or even helped me, to which I am grateful, however I have another question in the hope that I can develop something..

Basically we record Information that is later used to send an order acknowledgment or an order confirmation via email (typed manually) what I’d like to do is use the information from the DB and get access to create the acknowledgment or confirmation.

When the email is created it needs to as a memo and not an attachment. When I say “memo” I am referring as if you were starting a blank new email.

What is the best way to achieve this? Should I design the acknowledgment and confirmation as a report or a form?

Thanks again for the help.
Stuart


Sent from my iPhone using Tapatalk
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:56
Joined
Oct 29, 2018
Messages
21,456
Hi. If you want the email to look like it was written manually, then you would want to simply pass the data from the table to an email. How do you create the email now? Are you using Outlook?
 

StuartG

Registered User.
Local time
Today, 15:56
Joined
Sep 12, 2018
Messages
125
Hi. If you want the email to look like it was written manually, then you would want to simply pass the data from the table to an email. How do you create the email now? Are you using Outlook?



Hi Dbguy.
Yeah currently using Outlook 2016.

Are you able to create bespoke emails with pictures etc or will be text only?

Cheers..


Sent from my iPhone using Tapatalk
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:56
Joined
Oct 29, 2018
Messages
21,456
Would the pictures be different for each email? Or, are you able to use a template?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:56
Joined
Oct 29, 2018
Messages
21,456
I could use a template..
Well, you just made your life a lot easier. You can automate Outlook and create an email based off the template and populate it with data from your table then. If you need examples of how to do this, let us know, and I'll try to find some links for you.
 

StuartG

Registered User.
Local time
Today, 15:56
Joined
Sep 12, 2018
Messages
125
Well, you just made your life a lot easier. You can automate Outlook and create an email based off the template and populate it with data from your table then. If you need examples of how to do this, let us know, and I'll try to find some links for you.



Great.. easy is always better..

If you could provide some examples on how this is achieved that would be great. Does it require any VB programming as I haven’t a clue with that..


Sent from my iPhone using Tapatalk
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:56
Joined
Oct 29, 2018
Messages
21,456
Hi. Yes, "Outlook Automation" is done using VBA programming. I'll see if I can find some links for you.
 

StuartG

Registered User.
Local time
Today, 15:56
Joined
Sep 12, 2018
Messages
125
See my attempt at doing just this from a template. Should be something to start with at least.? The reason I used a template was this was started on 2003 and SendUsingAccount was not available in that version.

Post 11 in

Was there an attachment in this post?
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:56
Joined
Sep 21, 2011
Messages
14,235
Was there an attachment in this post?

Not an attachment, but a link, but I inadvertently placed it as an IMG and not URL link.

I've edited the post and it is there now.
 

StuartG

Registered User.
Local time
Today, 15:56
Joined
Sep 12, 2018
Messages
125
Hi All,
So i have been testing a few codes and like the way this code works, because it is simple to use.

This is the code below:

Public Function SendEmail2()

Dim varName As Variant
Dim varCC As Variant
Dim varSubject As Variant
Dim varBody As Variant

varName = "james@yahoo.com"
varCC = "billy@gmail.com, joe@yahoo.com"
'separate each email by a ','

varSubject = "Hello"
'Email subject

varBody = "This is a test"


'Body of the email
DoCmd.SendObject , , , varName, varCC, , varSubject, varBody, True, False
'Send email command. The True after "varBody" allows user to edit email before sending.
'The False at the end will not send it as a Template File

End Function


The issue I am experiencing is I am trying to put more that one line of Text in and this causes it to error, this is what I am trying to put in:


Thank you for your purchase order.

Quote:
Your Reference:
Total Value:

Please note that this is only an acknowledgement of receipt of your order and your contract to purchase these items is not complete until we send you an order confirmation.

Attached is a copy of the...

Please be aware that deliveries will be arranged.......

If a non-standard delivery is required (e.g. to a 1st floor laboratory) and is not included in the shipping of this instrument, please contact us and we can arrange a quotation from a specialist courier for you.

If you have any question in the meantime please do not hesitate to contact me.

I am also trying to attach a file, the file does not change, but needs to appear each time a user clicks the button.

Any help that can be provided would be great.. :)
 

StuartG

Registered User.
Local time
Today, 15:56
Joined
Sep 12, 2018
Messages
125
Does anyone think that this is the best way forward or do I need to rethink my idea?




Sent from my iPhone using Tapatalk
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:56
Joined
Oct 29, 2018
Messages
21,456
You would copy the code and put it in a Standard Module. Then, you just use it by calling the function and passing all the necessary arguments to send an email.
 

StuartG

Registered User.
Local time
Today, 15:56
Joined
Sep 12, 2018
Messages
125
You would copy the code and put it in a Standard Module. Then, you just use it by calling the function and passing all the necessary arguments to send an email.



Ok thank you. What I’ll do is put it all together tomorrow and do some trial and errors, if i get stuck I’ll ask the forum again.. [emoji106]


Sent from my iPhone using Tapatalk
 

Users who are viewing this thread

Top Bottom