SendObject - Outlook address format

M

meg

Hello,
I am using a command button on a form to send a report via Outlook to
the two people assigned to an issue. Names are entered in the database
as "Smith, John". The problem is that when the name gets to the To:
field in Outlook, the comma has been changed to a semicolon and Outlook
interprets that as 2 separate addresses. Is there any way to keep the
comma from being replaced with a semicolon? Here is the code I'm
using:

DoCmd.SendObject acReport, "rptIssueReport",
"RichTextFormat(*.rtf)", AssignedTo & ";" & AssignedTo2, "", "", "Issue
#" & IssueID, "", True, ""

Thanks for your help!
 
G

Guest

Hi meg,

If ALL names in your database are written in that manner, you could use the
following to fix the problem:

mid([AssignedTo], instr(1, [AssignedTo], ", ")+2) & " " & left([AssignedTo],
instr(1, [AssignedTo], ", ")-1)

This will change "smith, john" to "john smith".

Hope this helps.

Damian.
 
M

meg

Thanks. I did try something like that, but names in our Outlook
address book are "Smith, John" so they're not recognized if they go to
the address line as "John Smith". I'm working on parsing the string
and sending only the last name to the address line, but I haven't quite
gotten there yet. I think that will cover about 90% of the time, as we
don't have that many duplicate last names.


Damian said:
Hi meg,

If ALL names in your database are written in that manner, you could use the
following to fix the problem:

mid([AssignedTo], instr(1, [AssignedTo], ", ")+2) & " " & left([AssignedTo],
instr(1, [AssignedTo], ", ")-1)

This will change "smith, john" to "john smith".

Hope this helps.

Damian.

meg said:
Hello,
I am using a command button on a form to send a report via Outlook to
the two people assigned to an issue. Names are entered in the database
as "Smith, John". The problem is that when the name gets to the To:
field in Outlook, the comma has been changed to a semicolon and Outlook
interprets that as 2 separate addresses. Is there any way to keep the
comma from being replaced with a semicolon? Here is the code I'm
using:

DoCmd.SendObject acReport, "rptIssueReport",
"RichTextFormat(*.rtf)", AssignedTo & ";" & AssignedTo2, "", "", "Issue
#" & IssueID, "", True, ""

Thanks for your help!
 
T

Tony Toews

meg said:
Hello,
I am using a command button on a form to send a report via Outlook to
the two people assigned to an issue. Names are entered in the database
as "Smith, John". The problem is that when the name gets to the To:
field in Outlook, the comma has been changed to a semicolon and Outlook
interprets that as 2 separate addresses. Is there any way to keep the
comma from being replaced with a semicolon? Here is the code I'm
using:

DoCmd.SendObject acReport, "rptIssueReport",
"RichTextFormat(*.rtf)", AssignedTo & ";" & AssignedTo2, "", "", "Issue
#" & IssueID, "", True, ""

Try putting a set of double quotes around the name.

DoCmd.SendObject acReport, "rptIssueReport",
"RichTextFormat(*.rtf)", """" & AssignedTo & ";" & AssignedTo2 & """",
"", "", "Issue #" & IssueID, "", True, ""

Alternatively you may just need to store the email addresses in your
database and put those directly in the SendObject.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
A

Allan Murphy

Meg

I store the email addresses in a table then use a dlookup to retrieve the
names, BUT these addresses are all in one field e.g.
(e-mail address removed);[email protected] etc

sample code
dim temp_email_ss as string
dim email_ss as string

temp_email_ss = DLookup("[email_ss]", "[tbl_emails]", "id=1")
email_ss = temp_email_ss

DoCmd.SendObject , "", "", email_ss, "", "", "Loadings for " & Date + 1, "",
False, "
 
M

meg

Thanks for all the help! I ended up adding a column to my Assignee
table for email addresses and then used DLookup. Works like a charm!

strTo = DLookup("(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top