473,320 Members | 1,825 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

VBA code for emails

Wonder if any body can help. Got this code (only part of full code used for automatic emailing) for constructing an email from the record sets in my Access Database 2003. I have tried to adapt it from a template i have but keep coming up with errors in this bit of code.

Very new to VBA so can't see where i am going wrong.

Any ideas on how to alter it so it will run?

strEMailMsg = rst![Risk Assessors Name] & "completed a risk assessment on" & rst![Date] & " . " & Chr(10) & Chr(10) _
& "Below are the details of the Risk Assessment:"
Chr (10) & Chr(10) & rst![ReferenceNumber] & Chr(10) & Chr(10)
rst![Area] & Chr(10) & Chr(10)
& rst![State Problem and Risk] & Chr(10) & Chr(10)
& rst![Risk Level] & Chr(10) & Chr(10)
& rst![Action Taken] & Chr(10) & Chr(10)
rst![txtnextrevdate] & Chr(10) & Chr(10)
& "Regards"
Mar 29 '07 #1
3 1152
MMcCarthy
14,534 Expert Mod 8TB
You were missing a couple of ampersands. Try this ...
Expand|Select|Wrap|Line Numbers
  1. strEMailMsg = rst![Risk Assessors Name] & " completed a risk assessment on " & rst![Date] & " . " & Chr(10) & Chr(10)  & _
  2. "Below are the details of the Risk Assessment:" & Chr(10) & Chr(10) & _
  3. rst![ReferenceNumber] & Chr(10) & Chr(10) & rst![Area] & Chr(10) & Chr(10) & _
  4. rst![State Problem and Risk] & Chr(10) & Chr(10) & rst![Risk Level] & Chr(10) & Chr(10) & _
  5. rst![Action Taken] & Chr(10) & Chr(10) & rst![txtnextrevdate] & Chr(10) & Chr(10) & "Regards"
  6.  
Mary
Mar 29 '07 #2
Sorry but i've copied in the code and i get back "Compile error" Syntax error when i run the database.

Any ideas where i have gone wrong. What i want is my auto email code which is applied to the Exit control i have for the database to send an email which is in the following format using the following record sets:

[Risk Assessors Name] completed a Risk Assessment on the [Date].

Below are the details of the Risk Assessment:

[Reference Number]
[Area]
[State Problem and Risk]
[Risk Level]
[Action Taken]
[Next Review Date]

Regards
Mar 30 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
Sorry but i've copied in the code and i get back "Compile error" Syntax error when i run the database.

Any ideas where i have gone wrong. What i want is my auto email code which is applied to the Exit control i have for the database to send an email which is in the following format using the following record sets:

[Risk Assessors Name] completed a Risk Assessment on the [Date].

Below are the details of the Risk Assessment:

[Reference Number]
[Area]
[State Problem and Risk]
[Risk Level]
[Action Taken]
[Next Review Date]

Regards
Try to compile the database and see what errors it breaks on.
Mar 30 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: NotGiven | last post by:
The code below is designed to loop through rows of a database query obtaining email addresses and send an email to each. It is modified form fomr some code I found on the net. With each while...
7
by: news | last post by:
Before I begin, I realise there's a big war regarding HTML in e-mails. Personally, I don't like it. Unfortunately, I'm being paid by my company to create an automated newsletter for our customers....
0
by: Thomas Mandelid | last post by:
A client I`m working for want to be able to send multiple emails to customers of their own. I have developed a simple app to accomplish this, but the application has a few flaws and I`m looking for...
0
by: Steven Scaife | last post by:
There seems to be a problem with my emailing code, although during testing it worked fine. What happens is it sends two emails instead of one, and also doesn't put any text in the email for some...
4
by: ItsMe | last post by:
Dear All, I'm getting junk email with around 140-150 kb almost everyday and it my mailbox is getting full and this emails are full of virus effected attachments. And I'm getting these emails...
4
by: Christine Forber | last post by:
I wonder if anyone knows of some javascript code to check a comma-delimited list of email addresses for basic formating. What I'm looking for is the javascript code to check a form field on form...
5
by: sck10 | last post by:
Hello, I am working on a new project where I need to: 1. open an email and then create an xml file from the email 2. open the xml file and parse the information. I would like to be able to do...
2
by: =?Utf-8?B?RGFuY2Vy?= | last post by:
Hi, I was attempting to check my new incoming emails through Outlook Express (I have Windows 98, 2nd Edition). My computer seemed to be having a problem accessing and opening the emails, and the...
0
by: =?Utf-8?B?Q2hhcmxlcw==?= | last post by:
Like many people, I normally use Yahoo! Mail via the web and like to keep all my emails stored on the Yahoo! server. However sometimes I can’t get access to a PC/the web and I download my emails...
0
by: =?Utf-8?B?UmljaA==?= | last post by:
Hello, My company will be hosting a webcast, and I need to send out 2000 individual emails to people who signed up (for login information...). I created an smtp app that I can loop through...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.