2002-11-08, 09:45 #1
- Join Date
- Feb 2002
- A Magic Forest in Deepest, Darkest Kent
- Thanked 1 Time in 1 Post
Email form details as text (A97 )
I have a colleague who has created a very basic Access database which has a single table with a list of contractors. He approached me yesterday asking if it was possible to send the details of a new contractor to managers via email. I said "Yes"!!!!
I have done this before using something similar to Post 188086 which uses this piece of code:
DoCmd.SendObject acSendNoObject, , acFormatTXT, "TheBoss@mywork.com",,,,"the workorder is "& forms!myform!workorder
This is fine if you want to send out one fields worth of information in text format but I would like to put several fields worth of info. such as Contractors name, address, telephone number, email etc in a format that makes it easy to read on an email. Is this possible?
I suppose I could append &forms!myform!contractor but then all I get is a long string of gobbledigook. Is there a command to force a line break in between them?Jerry
Subscribe to our Windows Secrets Newsletter - It's Free!
Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!
+ Get this BONUS — free!
Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!
2002-11-08, 10:01 #2
- Join Date
- Mar 2002
- Thanked 16 Times in 16 Posts
Re: Email form details as text (A97 )
You can use vbCrLf to insert a line break into a string, for example:
Dim strMessage As String
strMessage = ",,,,"The workorder is "& forms!myform!workorder & vbCrLf & _
"Contractor: " & forms!myform!contractor & vbCrLf & vbCrLf & _
"Yours sincerely," & _
DoCmd.SendObject acSendNoObject, , acFormatTXT, "TheBoss@mywork.com", , , , strMessage