Using Access to obtain E-mail address

J

JIMC5499

I am working on an Access 2003 database to manage Engineering Change Notices.
A form is filled out and upon completion a folder is created and a .SNP file
is placed in the folder. When that is complete I am using a button to run an
Outlook event that sends an e-mail to the ECN Coordinator. The ECN
Coordinator's e-mail address never changes so it is coded. What I need is
the Originator's e-mail address to send them a copy.
In my database the Originator's address is entered in the ORIGINATOR_EMAIL
field. The section that generates the .SNP file sets the varible
strOriginator equal to ORIGINATOR_EMAIL with strOriginator being a Public
String varible. My Outlook code is as follows.


Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Dim strCopy As String
strCopy = strOriginator
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = "ECN (e-mail address removed)"
.CC = strCopy
.Subject = "A New ECN has been created"
.Body = "A new ECN has been created and is ready to be entered"
.Attachments.Add strRetrieve
.Send
End With

I'm not getting any errors, but, the .CC e-mail isn't being sent.
 
K

Ken Slovak - [MVP - Outlook]

Is that address in the correct format? Does strCopy have the value you want
when you are setting the Cc value? Step the code and see what's happening.
 
K

Ken Slovak - [MVP - Outlook]

Well, only you know the setup of your Access database and tables, so you
need to populate that value so it gets applied to the Cc address of the
email.
 
J

JIMC5499

That's the problem I'm having. I'm using the ORIGINATOR_EMAIL field in the
record to provide the value for strOriginator, then I'm using strOriginator
to provide the value for strCopy. I have ORIGINATOR_EMAIL 's field set to
text. Is that correct for an e-mail address?
 
K

Ken Slovak - [MVP - Outlook]

Yes, an email address is a string (text), but you indicated that you were
seeing a null string. Obviously that won't work.
 

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