R
Robert_L_Ross
I've got a form called EMail in MSAccess that contains a field named
EMailToAddress. This field populates from a table of e-mail addresses.
On the EMail form, I have a subform (Messages) that has 2 fields (Subject
and Message).
On the main form (EMail) I have a button I want to use to send an e-mail to
the address specified on the EMail form (EMailToAddress) and that uses the
Subject and Message field contents from the subform.
Here's the code:
Private Sub EMail_Click()
Dim ToAddress, CCAddress, BCCAddress, Subject, MessageText As String
ToAddress = Forms!!EMailToAddress
CCAddress = "[email protected]"
BCCAddress = "[email protected]"
Subject = Forms![EMail]![Messages subform].Form![Subject]
MessageText = Forms![EMail]![Messages subform].Form![Message]
msg = MsgBox(ToAddress, vbOKOnly, "Test")
DoCmd.SendObject acSendForm, , acFormatTXT, ToAddress, CCAddress,
BCCAddress, Subject, MessageText, True
End Sub
My problem is the e-mail is generated with no "To" address, even though I
specify it by the variable ToAddress. I even tried putting the actual field
in the DoCmd.SendOjbect statement. The only way it populates that field is
if I set the varable value to "[email protected]" or place the actual e-mail in quotes in
teh DoCmd.SendObject statement.
Any ideas?
EMailToAddress. This field populates from a table of e-mail addresses.
On the EMail form, I have a subform (Messages) that has 2 fields (Subject
and Message).
On the main form (EMail) I have a button I want to use to send an e-mail to
the address specified on the EMail form (EMailToAddress) and that uses the
Subject and Message field contents from the subform.
Here's the code:
Private Sub EMail_Click()
Dim ToAddress, CCAddress, BCCAddress, Subject, MessageText As String
ToAddress = Forms!!EMailToAddress
CCAddress = "[email protected]"
BCCAddress = "[email protected]"
Subject = Forms![EMail]![Messages subform].Form![Subject]
MessageText = Forms![EMail]![Messages subform].Form![Message]
msg = MsgBox(ToAddress, vbOKOnly, "Test")
DoCmd.SendObject acSendForm, , acFormatTXT, ToAddress, CCAddress,
BCCAddress, Subject, MessageText, True
End Sub
My problem is the e-mail is generated with no "To" address, even though I
specify it by the variable ToAddress. I even tried putting the actual field
in the DoCmd.SendOjbect statement. The only way it populates that field is
if I set the varable value to "[email protected]" or place the actual e-mail in quotes in
teh DoCmd.SendObject statement.
Any ideas?