A problem with SendObject

E

ericb

On a form is a populated list and command buttons. One of them is to e-mail a
report.

Everything works well except for one detail, I can use the
lettre_introduction file as the template to the body of the e-mail in Outlook

The file lettre_intrduction is a htlm file.

Here is my code :

If Forms![Home Base]![cmdClient].Enabled = True Then
strRapport = "Rapport client" ' Le rapport
à utiliser
strDestinataire = Forms![Home Base]![Liste Client HB
subform].[Form]![nom_client]

Else ' Le client à qui e-mailer
If Forms![Home Base]![cmdMedecin].Enabled = True Then ' E-mail à
un docteur
strRapport = "Rapport medecin" 'Le rapport
à utiliser
Else
strRapport = "Rapport suggestion"
End If

' Le doc à qui e-mailer
strDestinataire = frmSelect.Column(lngNocolumn_doc_ListProduit,
lngChoix)
End If

' E-mail le rapport
DoCmd.SendObject acSendReport, strRapport, , strDestinataire, ,
, "Un rapport de consultation", , True, "C:\Users\Eric\Documents\Base Données
Patients\lettre_introduction"

The path is OK

What am I doing wrong ?

Thank you
 
A

andrewmrichards

On a form is a populated list and command buttons. One of them is to e-mail a
report.

Everything works well except for one detail, I can use the
lettre_introduction file as the template to the body of the e-mail in Outlook

The file lettre_intrduction is a htlm file.

Here is my code :

      If Forms![Home Base]![cmdClient].Enabled = True Then
         strRapport = "Rapport client"                          ' Le rapport
à utiliser
         strDestinataire = Forms![Home Base]![Liste Client HB
subform].[Form]![nom_client]

      Else ' Le client à qui e-mailer
         If Forms![Home Base]![cmdMedecin].Enabled = True Then  ' E-mail à
un docteur
            strRapport = "Rapport medecin"                      'Le rapport
à utiliser
         Else
            strRapport = "Rapport suggestion"
         End If

         ' Le doc à qui e-mailer
         strDestinataire = frmSelect.Column(lngNocolumn_doc_ListProduit,
lngChoix)
      End If

      ' E-mail le rapport
            DoCmd.SendObject acSendReport, strRapport, , strDestinataire, ,
, "Un rapport de consultation", , True, "C:\Users\Eric\Documents\Base Données
Patients\lettre_introduction"

The path is OK

What am I doing wrong ?

Thank you

Hi Eric

I've had problems before with trying to send HTML emails using an
outlook template file. In the end what I normally end up doing is
creating the email manually by having a table that holds the contents
of the email in HTML (so <p>
 
A

andrewmrichards

On a form is a populated list and command buttons. One of them is to e-mail a
report.

Everything works well except for one detail, I can use the
lettre_introduction file as the template to the body of the e-mail in Outlook

The file lettre_intrduction is a htlm file.

Here is my code :

      If Forms![Home Base]![cmdClient].Enabled = True Then
         strRapport = "Rapport client"                          ' Le rapport
à utiliser
         strDestinataire = Forms![Home Base]![Liste Client HB
subform].[Form]![nom_client]

      Else ' Le client à qui e-mailer
         If Forms![Home Base]![cmdMedecin].Enabled = True Then  ' E-mail à
un docteur
            strRapport = "Rapport medecin"                      'Le rapport
à utiliser
         Else
            strRapport = "Rapport suggestion"
         End If

         ' Le doc à qui e-mailer
         strDestinataire = frmSelect.Column(lngNocolumn_doc_ListProduit,
lngChoix)
      End If

      ' E-mail le rapport
            DoCmd.SendObject acSendReport, strRapport, , strDestinataire, ,
, "Un rapport de consultation", , True, "C:\Users\Eric\Documents\Base Données
Patients\lettre_introduction"

The path is OK

What am I doing wrong ?

Thank you

Hi Eric

I've had problems before with trying to send HTML emails using an
Outlook template file. In the end what I normally end up doing is
creating the email manually by having a table that holds the contents
of the email in HTML (so <p> to create a new paragraph, for example,
and <img> when I want to embed an image) and then having code that
loops through the appropriate rows and constructs the email, before
sending it using something along the lines of the code available at
http://www.everythingaccess.com/tutorials.asp?ID=Outlook-Send-E-mail-Without-Security-Warning
to avoid the normal Outlook warnings...

This avoids the need for using Template stationery in Outlook, and has
the benefits of (a) you're not reliant on an external file which might
be moved by someone, (b) you can edit the content of the email from
within Access, and (c) it actually works, unlike using stationery!!

Best regards

Andrew
 

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

Similar Threads

Ribbon command problem 1
A string problem 6

Top