SendObject/Email Related Problem

D

Denis

Hello,
Using the following code, I am able to send an email to
the "TO:" addressee without problems (well - expect for
the typical'A program is trying to send 'blah blah blah
warning).

The problem is that when a user attempts to send a
subsequent email, say from a different record, nothing
happens. In short - the only way I can get the function to
work more than once is by closing and reopening the
database.

Do you know how I can get the function to work more than
once?

Thanks for your help and here is the code:

Denis B.

Private Sub chkCAPSatisfactory_Click()
Dim i As TextBox
Dim j As TextBox
Dim c As TextBox
Dim o As TextBox

Set i = PROBE
Set j = CategoryID
Set c = txtCAP
Set o = Observation

If chkCAPSatisfactory = -1 Then
DoCmd.SendObject
acSendNoObject, , , "(e-mail address removed)", , , "" _
& "Incoming Corrective Action Plan for: " & i & "
(Cat " & j & ")", "" _
& "CAP: " & i & vbCrLf & vbCrLf & "-----PROBE -----" &
vbCrLf & o & vbCrLf & vbCrLf & "-----CAP -----" & vbCrLf &
c, False

Else
End If
End Sub
 
W

William Taylor

for automation to work more that once it needs to reference the highest
object (application) and then the fully qualified path to the automation
object. This is a known issue from microsoft.
try this and see if it works.
Dim TopApp As Application
TopApp.DoCmd.SendObject
 
D

Denis

Hi William,
I may be doing something wrong/missing something, but I
tried your solution without success (I received a Run time
error '91' - <Object variable or With Block variable not
set>. I then added:
Set TopApp = Me.Application

After this, I tried it again and could not get it to work
more than once.

Thanks for your time.
Denis
 
D

Denis

Problem resolved! I changed the
"Set TopApp = Me.Application"
to
"Set TopApp = Access.Application"
and it is working just fine!

Thank you William and to those of you who took the time to
research this problem for a solution.

Cheers!
Denis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top