sending emails from access

pteare

Registered User.
Local time
Yesterday, 18:32
Joined
Sep 24, 2008
Messages
31
Hello,

I've been having a few problems with sending emails from access. I've a form which has all the info on it about a particular guest. I have a button that I press to email this guest using info from the form.

I think it works fine when outlook is already open. If though outlook is closed and I'm sending the first email of the day then it seems to open outlook then open countless message composition windows in outlook, often around 50 identical ones.

Any ideas would be gratefull received! I've been trawling the internet reading lots of code from other people's emailing but I still don't really understand what the problem is.

Thanks!

Phil.

Code:
Private Sub cmdSendThisEmail_Click()
Dim objOutlook As New Outlook.Application
Dim objMail As MailItem
Set objOutlook = New Outlook.Application
Set objMail = objOutlook.CreateItem(olMailItem)

'creates the email
With objMail
.To = Me.email
.BCC = "[EMAIL="philteare@yahoo.co.uk"]philteare@yahoo.co.uk[/EMAIL]"
.Subject = Me!sfrmCorrespondance!Subject
.Body = Me!sfrmCorrespondance!contents
.Display
End With
'Send the email without prompts
SendKeys "%{s}", True
Set objMail = Nothing
Set objOutlook = Nothing
End Sub
 
I am not familar with this process but the problem could be because of the way you are using "New". You don't need "New" in both the Dim and Set statements.
 
hi pat,

thanks for that. Just got rid of those News as per your advice thanks.

it still loves to send lots of emails! I have discovered though it keeps sending emails until I click on one of the pop up email display windows (in outlook) then it stops?!? strange.

Any ideas?!

Thanks everyone!

Phil.
 

Users who are viewing this thread

Back
Top Bottom