send report

W

walter becke

Hello Everybody
I have a severe problem with configuring a button that sends a report per
email. The following code does its job:

Private Sub BerichtSendPL_Click()
On Error GoTo Err_BerichtSendPL_Click
Dim stDocName As String, mldg, titel, antwort, subject, cc

cc = LayoutText
subject = "Leiterplatten-Bestellung"
stDocName = "EildienstIntern"
DoCmd.SendObject acReport, stDocName, _
acFormatRTF, Forms![Eildienst Bestellantrag].PLMail, cc, , subject

Exit_BerichtSendPL_CLick:
Exit Sub

Err_BerichtSendPL_Click:

mldg = "Mögliche Fehler:" & Chr(13) & Chr(10) & _
"1) Es ist kein Aussteller gewählt." & Chr(13) & Chr(10) & _
"2) Das Feld 'Projektleiter-Email' ist leer"
titel = "Fehler beim Senden"
antwort = MsgBox(mldg, vbOKOnly, titel)

Resume Exit_BerichtSendPL_CLick

End Sub

BUT the next DOES NOT! When I click on the button I get the errormessage and
after clicking 'OK' I have to shutdown Access with the taskmanager.

Private Sub BerichtSendFirma_Click()
On Error GoTo Err_BerichtSendFirma_Click

Dim stDocName As String
Dim cc As String
Dim mldg, titel, antwort, subject

If Forms![Eildienst Bestellantrag].[Email-Empfänger].Visible = True Then
cc = Forms![Eildienst Bestellantrag].[Email-Empfänger]
Else
cc = ""
End If

subject = "Leiterplatten-Bestellung"
stDocName = "EildienstExtern"
DoCmd.SendObject acReport, stDocName, acFormatRTF, Forms![Eildienst
Bestellantrag].LiefMail, cc, , subject

Exit_BerichtSendFirma_Click:
Exit Sub

Err_BerichtSendFirma_Click:
mldg = "Mögliche Fehler:" & Chr(13) & Chr(10) & _
"1) Es ist kein Aussteller ausgewählt" & Chr(13) & Chr(10) & _
"2) Dem Lieferant ist keine Email-Adresse zugeordnet." & Chr(13) &
Chr(10) & _
"3) 'Musterbau' ist angeklickt und dem Fax-Empfänger ist keine
Email-Adresse zugeordnet"


titel = "Fehler beim Senden"

antwort = MsgBox(mldg, vbOKOnly, titel)
Resume Exit_BerichtSendFirma_Click

End Sub

Can anyone tell me where the error is? I cannot figure it out :(

TIA Walt
 

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


Top