I have the code below under a button on a form. At this point am just
testing how to send email from MS Access. Access is installed on a
machine running WinXP Pro. I checked the box next to Microsoft CDO
for Windows 2000 under References. I can send one message and then if
can close Access no problems. If I click the button several times to
send several emails then Access hangs. I have to use task manager to
kill it off. Either way, all of the emails get sent ok. Any ideas
why Access is hanging???
Thanks,
TD
Private Sub Command30_Click ()
On Error GoTo Err_Command30_C lick
Dim cdoConfig
Dim msgOne
Set cdoConfig = CreateObject("C DO.Configuratio n")
With cdoConfig.Field s
.Item(cdoSMTPSe rverPort) = 25
.Item(cdoSMTPSe rver) = "smtp.myisp.net "
.Item(cdoSMTPAu thenticate) = cdoBasic
.Item(cdoSendUs erName) = "me@myisp.c om"
.Item(cdoSendPa ssword) = "password"
.Item(cdoSendUs ingMethod) = cdoSendUsingPor t
.Update
End With
Set msgOne = CreateObject("C DO.Message")
Set msgOne.Configur ation = cdoConfig
msgOne.To = yo*@yourdomain. com
msgOne.From = "me@mydomain.co m"
msgOne.Subject = "Test"
msgOne.TextBody = "It works just fine"
msgOne.Send
Set cdoConfig = Nothing
Set msgOne = Nothing
Exit_Command30_ Click:
Exit Sub
Err_Command30_C lick:
MsgBox Err.Description
Resume Exit_Command30_ Click
End Sub