473,769 Members | 5,784 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending email hangs Access 2003

TD
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
Aug 15 '08 #1
1 3836
Since you've set a reference to CDO you can use early binding as in:

Public Sub SimpleSendMailW ithCDOB()
'early binding
'requires reference to cdosys.dll

Dim iCfg As CDO.Configurati on
Dim iMsg As CDO.Message

Set iCfg = New CDO.Configurati on
Set iMsg = New CDO.Message

With iCfg.Fields
.Item(cdoSendUs ingMethod) = cdoSendUsingPor t
.Item(cdoSMTPSe rverPort) = 25
.Item(cdoSMTPSe rver) = "smtp.cogeco.ca "
.Item(cdoSMTPAu thenticate) = cdoBasic
.Item(cdoSendUs erName) = "username"
.Item(cdoSendPa ssword) = "password"
.Item(cdoSendEm ailAddress) = "your name <your email address>"
..Update
End With

With iMsg
.Configuration = iCfg
.Subject = "Test Late Binding"
.To = "so*****@domain .tld"
.TextBody = "Test"
.send
End With

Set iMsg = Nothing
Set iCfg = Nothing

End Sub

This may help with Access's not releasing the pointers to cdoConfig
and/or msgOne before you recreate them. Then again it may not.

TD <dl**@adsi-sc.comwrote in news:bc7ae580-56fd-4584-ba25-8cdd8a833d10
@v16g2000prc.go oglegroups.com:
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
Aug 15 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3615
by: Setya Nugraha Djajadinata | last post by:
Hi all, I try to open an mdb and it gives error message : The database 'c:\MyDB\PDz.mdb' needs to be repaired or isn't a database file. You or another user may have been unexpectedly quit Microsoft Access while a Microsoft Access database was open. Do you want Microsoft Access to attempt to repair the database ?
2
2091
by: Del | last post by:
I have two question on sending email messages from MS Access (Versio 2000, 2002, and 2003). I have a form with a command button to send an email message, the code behide the button is as follows; ============================================================================= Dim strRecipient As String Dim strSubject As String Dim strMessageBody As String
1
4171
by: Devonish | last post by:
I am composing an email with Access VB and then sending it from within Access. Everything works correctly (the email actually goes!) but Outlook ask some irritating questions that the user is required to answer. A summary of the relevant code is: Dim mailObj as Outlook.MailItem
0
4201
by: Mike Knight | last post by:
(I've also posted this problem on microsoft.public.excel.programming) I have a MS Access 2003 Database named "AS400 Fields.mdb". This database contains links to tables on an AS400. In MS Excel 2003, I have VBA code that creates and executes queries using the Access database, and returns the results to an Excel sheet. The first time the query is executed, results are returned to Excel in usually less than 10 seconds. However, if the...
7
3556
by: Marcin | last post by:
Hello all! A few years ago I created a form with button which let me send an email with an attachment. It was created in Access 97. Now I would like to move this application into Access 2003. But when I did it, sending email code doesn`t work. Can you be so kind and give me the code how to send email with and without attachment in vb in Access 2003?? Thank you in advance
1
2768
by: festivalman | last post by:
Hi, sorry if this is in the wrong spot. Finding the newsgroups on MS's site could have been easier Here's my problem I've got some old asp's that are running our simple web site. In a section, there's a contact for that collects a few lines of info, and when you hit submit, it takes that and sends it to a specifie email address. It's been working all this time, but recently we just bought and implemented exchange 2003 on the server and...
0
1243
by: Bob Alston | last post by:
I am having trouble on a client PC getting the Office link, to send an access report I am viewing to MS Word. Also I cannot get send to - mail recipient to work either. The command box pops up as usual but just hangs and never completes. On my home Win xp Office 2003 it works just fine. My client has Win XP and Office 2002.
1
8182
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to the members of my organization. I think my problem is incorrectly setting the settings on my server or an authentication problem. Here is the code I have written to send a test message: -----Code Begins: Sensitive Information Replaced by -----...
0
1235
by: Lauren Wilson | last post by:
What is going on with this? We created an installer for Access 2003 Runtime using the P & D Wizard from Access 2003 Dev Extensions. It appeared to be fine but on some computers it simply hangs on "Installing fonts" and the Task Manager shows "not responding." Does anyone know what could be causing this? Thanks in advance for all responses.
0
10216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.