Sending email gives 'application is busy' error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I have an Access application running on a server where the user can send an
email to an Outlook user from Access. This all works fine except sometimes
the user gets a message that says:

The action cannot be completed because the other application is busy.
Choose switch to to activate the busy application and correct the problem.

Then the database hangs. It almost seems like there is a window somewhere
that requires a response.

My questions is, do I need to 'test' for Outlook being open before I create
a new instance? If so, how is that done? Has anyone encoutered this error
before?


My code is as follows:
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem

'Create the Outlook session
Set objOutlook = New Outlook.Application

'Create message
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
'set the recipients
Set objOutlookRecip = .Recipients.Add(EmplEmail)
objOutlookRecip.Type = olTo
'set the subject, body, etc.
.Subject = .....
MsgText = ....
.Body = MsgText

For Each objOutlookRecip In .Recipients
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send
End With

Thank you very much.
Debbie
 
Hi Debbie

instead of

Set objOutlook = New Outlook.Application

try

Set objOutlook = CreateObject("Outlook.Application")


Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 
Crystal,
Thank you I will try that. Can you explain what that is really doing? If
Outlook is open, will it create another instance of it? Thanks,
Debbie
 
Hi Debbie,

this is the full code I got from Ricky Hicks (another MVP
and a sheer genius) for composing messages in Outlook. I do
not use Outlook, but have given this code out lots of times
and have only heard good things about it. I have also used
this code in applications I have sent to others who use
Outlook (without testing it) and, once again ... no problem

I did not answer your question, but will take a guess...
each time you make a new message, you are creating another
instance of Outlook because it appears in a new window

'~~~~~~~~~~~~~~~~~
Function MailParameters()

Dim outApp As Outlook.Application, outMsg As MailItem
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)

With outMsg
'.Importance = olImportanceHigh
.To = Me.eMailAddress
'.CC = "CC EMAIL ADDRESS GOES HERE"
'.BCC = "BCC EMAIL ADDRESS GOES HERE"
' .Subject = "YOUR SUBJECT GOES HERE"
' .Body = "YOUR_E-MAIL_MESSAGE_GOES_HERE"
'.Attachments.Add _
"YOUR FILE PATH AND NAME", , , "YOUR FILES NAME"

' If you want to edit before sending
.Display
'otherwise, to just send without looking...
'.Send

End With

Set outApp = Nothing
Set outMsg = Nothing

End Function
'~~~~~~~~~~~~~~~~~


Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 
Back
Top