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!

generating email through access 2

Status
Not open for further replies.

striker73

MIS
Jun 7, 2001
376
US
I have a form in my database with a command button it. I want to generate an email when the button is clicked, but not send it. Based on the criteria on the form (checkboxes, etc.) I want to select a list of email addresses stored in the database and put those in the To: section of the email. Is there anyway to just create an email and not send it? I have been messing with the docmd.sendobject function, but that sends the email. Any ideas? Thanks!
 
Make sure that the lst criteia is set to "True" then the email is NOT sent. The following code will start an email and wait for you to change things in it before you hit "send"

Private Sub Email_Scientist_Click()

If IsNull(Me![Scientists.Email]) Then
MsgBox "Please enter an email address before emailing."
Else

DoCmd.SendObject acSendNoObject, , , Me![Scientists.Email], , , [Subject], [Comments], True

End If

End Sub

Hope that helps!

Ajoy
 
Try using the MailItem Object. This example compiles and sends a message with an attachment:

Dim objMailItem As MailItem

Set objMailItem = Outlook.CreateItem(olMailItem)
objMailItem.Subject = <The Subject>

objMailItem.Attachments.Add Source:=i_strFilename, Type:=olByValue

objMailItem.Recipients.Add i_strAddress

Then when all the bits and bobs have been added:

objMailItem.Send


M :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top