D
dbguru316
I have the below code that creates an outlook e-mail. I get the error
message "Outlook could not recogniz one or more names." Now varemailtro is
where the error occurse. This variable is equal to the "(e-mail address removed)",
and have added a msgbox to show what it is equal to, so I know it exists and
with the quotes..... The line in the code for declaring its value is:
varemailtrto = Chr(34) & DLookup("[TransmittalEmailAddress]",
"tblTransmittalTo", "[TransmittalTo] Like '" &
[Forms]![frmTransmittal]![TransmittalTo] & "'") & Chr(34)
When varemailtro is used the error message occurs. If I replace the variable
from .To = varemailtrto ....
to .To = "(e-mail address removed)" .....it works, no errors. Any ideas why this
variable approach does not work?
Set objCDOConfig = CreateObject("Outlook.Application")
Set MyItem = objCDOConfig.CreateItem(0) 'olMailItem
With MyItem
.To = varemailtrto
.Subject = "Test"
.ReadReceiptRequested = False '
.Body = "test"
.Send
End With
Set objCDOConfig = Nothing
message "Outlook could not recogniz one or more names." Now varemailtro is
where the error occurse. This variable is equal to the "(e-mail address removed)",
and have added a msgbox to show what it is equal to, so I know it exists and
with the quotes..... The line in the code for declaring its value is:
varemailtrto = Chr(34) & DLookup("[TransmittalEmailAddress]",
"tblTransmittalTo", "[TransmittalTo] Like '" &
[Forms]![frmTransmittal]![TransmittalTo] & "'") & Chr(34)
When varemailtro is used the error message occurs. If I replace the variable
from .To = varemailtrto ....
to .To = "(e-mail address removed)" .....it works, no errors. Any ideas why this
variable approach does not work?
Set objCDOConfig = CreateObject("Outlook.Application")
Set MyItem = objCDOConfig.CreateItem(0) 'olMailItem
With MyItem
.To = varemailtrto
.Subject = "Test"
.ReadReceiptRequested = False '
.Body = "test"
.Send
End With
Set objCDOConfig = Nothing