Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to write a Send Mail form

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am attempting to write a form that sends mail to the administrator (that be me) of the database. I keep getting getting a compile error (method or data member not found). Can someone check this for me and tell me if they see what the problem is? Thank you!<br>
<br>
Here is the code:<br>
<br>
Private Sub Send_Click()<br>
<br>
<br>
<br>
Dim objSession As Object<br>
Dim objMessage As Object<br>
Dim objRecipient As Object<br>
<br>
'Create the Session Object<br>
Set objSession = CreateObject(&quot;mapi.session&quot;)<br>
<br>
'Logon using the session object<br>
'Specify a valid profile name if you want to<br>
'Avoid the logon dialog box<br>
objSession.Logon profileName:=&quot;MS Exchange Settings&quot;<br>
<br>
'Add a new message object to the OutBox<br>
Set objMessage = objSession.Outbox.Messages.Add<br>
<br>
'Set the properties of the message object<br>
<br>
<br>
<br>
objMessage.subject = subject.TextBox <br>
<br>
objMessage.Text = Message.TextBox<br>
<br>
'Add a recipient object to the objMessage.Recipients collection<br>
Set objRecipient = objMessage.Recipients.Add<br>
<br>
'Set the properties of the recipient object<br>
objRecipient.Name = &quot;<A HREF="mailto:john@tritechlabs.com">john@tritechlabs.com</A>&quot; <br>
objRecipient.Type = mapiTo<br>
objRecipient.Resolve<br>
<br>
'Send the message<br>
objMessage.Send showDialog:=False<br>
MsgBox &quot;Message sent successfully!&quot;<br>
<br>
'Logoff using the session object<br>
objSession.Logoff<br>
<br>
End Sub<br>
<br>
<p>John Vogel<br><a href=mailto:john@computerwiz.net>john@computerwiz.net</a><br><a href=I am currently working on It should be LIVE 1/12/00 or before. I would appreciate suggestions, comments and the like. Please go look and help. Thanks.<br>
---========================
 
Can you run this in Step Mode (F8) and see what line it's failing on?
 
Yeah get rid of it and use the following its works great and takes up a lot less real estate.<br>
DoCmd.SendObject acSendNoObject, &quot;&quot;, acFormatTXT, &quot;ChrisC&quot;, , , &quot;---------HOT ORDER-------&quot;, Redinfo, False<br>
<br>
type in DoCmd.SendObject then double click on the SendObject word then Press F1 and it will bring up Help so you know what each parameter does.<br>
<br>
PS it also works for sending e-mail outside the building.<br>
hope this Helps<br>
DougP<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top