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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook 2000 email from Access. System hangs up!

Status
Not open for further replies.

raffao

Technical User
Mar 17, 2003
5
IT
Hi everybody,
i'm using a routine which sends emails from Access and it seems to work great. Ok.

But...

my system hangs when i use it. I mean, the routine starts but Access freezes while sending.
I have to go in the Task Manager, stop Outlook, so that Access recovers but without sending anything.
I tried to set the task priority of Access in the Task Manager to the lowest grade and only in this case it seems to work correctly...

Any suggestions to correct this problem without managing the tasks manually every time??

My configuration is:
Win XP pro SP1
office 2000 SR1 SP3 (both Outlook and Access)
512 mb ram
gigabytes of hard disk free space

Thanks in advance.
 
It might be worth posting your code, just incase there's something there that's causing it.
When you say it works great, does that mean it used to work before?

Sharon
 
The user writes the subject in the form and have to choose a HTML file as the body message.
That's the code:
____________________________
Sub SendEMail()

Dim MyOutlook As Outlook.Application
Dim MyMail As Outlook.MailItem
Dim BodyFile As String
Dim fso As FileSystemObject
Dim MyBody As TextStream
Dim MyBodyText As String
Dim OggettoEmail As String
Set fso = New FileSystemObject

' set the subject
OggettoEmail = Nz(Forms!email!oggetto, "")

' If there's no subject...

If OggettoEmail = "" Then
MsgBox "Specificare un Oggetto dell'Email prima di spedire.", vbInformation, "Spedizione EMail"
Forms!email!oggetto.SetFocus
Exit Sub
End If

' set the body

BodyFile = Nz(Forms!email!txtPathAndFile, "")

' If there's no body...
If BodyFile = "" Then
MsgBox "Non è stato specificato il file che contiene il testo del messaggio.", vbInformation, "Spedizione EMail"
Forms!email!Comando27.SetFocus
Exit Sub
End If

' I want to put an HTML file as body of the message. Does the file exist?
If fso.FileExists(BodyFile) = False Then
MsgBox "ATTENZIONE!" & vbNewLine & vbNewLine & "Il file specificato come testo del messaggio non esiste. Impostarne un altro.", vbCritical, "Il File non esiste"
Forms!email!Comando27.SetFocus
Exit Sub
End If

' I've got the file, I open it up.
Set MyBody = fso_OpenTextFile(BodyFile, ForReading, False, TristateUseDefault)

'and read it into a variable.
MyBodyText = MyBody.ReadAll

' and close the file.
MyBody.Close


' Now, let's open Outlook ..
Set MyOutlook = New Outlook.Application


Set MyMail = MyOutlook.CreateItem(olMailItem)

MyMail.To = "raffao@virgilio.it"

MyMail.Subject = OggettoEmail

MyMail.HTMLBody = MyBodyText

MyMail.Send


Set MyMail = Nothing

MyOutlook.Quit

End Sub
__________________________________

It only works if i set the task priority of Access to the lowest grade in Task Manager. If it is set to "normal" (as it is by default) Access freezes, not all the system, and I have to stop the task of Outlook which is frozen as well.
 
I should have found the solution and now it seems to work correctly always.
I just cut out from the code this row:
Set MyMail = Nothing

I don't know why, i'm not a real technician, but it's good :))

Bye all
 
Weird! Oh well, at least it works, glad you found a solution.

Sharon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top