|  | |
 | 
 Member
 
 Beiträge: 5
 
 
 | Hallo, 
 kann mir jemand bei folgendem VBA-Code in Access helfen?
 
 Dim rst As DAO.Recordset
 Dim strSQL As String
 Dim olApp As Outlook.Application
 Dim objMail As Outlook.MailItem
 
 Dim strTableBeg As String
 Dim strTableBody As String
 Dim strTableEnd As String
 Dim strFntNormal As String
 Dim strTableHeader As String
 Dim strFntEnd As String
 
 
 Dim strBody As String
 
 strBody = "Sehr geehrte Damen und Herren, " & "
 " & "
 " & _
 "Folgende Fehler:     " & "
 " & "
 " & _
 "Bemerkung: " & Me!Bemerkung_Palette & "
 " & "
 "
 
 
 
 
 
 'Define format for output:
 strTableBeg = "
 
 " 
 'Das kommt nach der Tabelle:
 strTableEnd = "Wir bitten um Korrektur." & "
 " & "
 " & _
 "Vielen Dank."
 
 
 'Tabellenüberschriften:
 strTableHeader = "(34) & ">" & _
 "
 " & _ "TD("Artikel") & _
 TD("Anzahl") & _
 TD("Fehlerart") & _
 TD("Bemerkung") & _
 "
 
 strFntNormal = "(34) & " size=3>"
 strFntEnd = ""
 
 
 'Datenherkunft definieren:
 
 sSQL = " SELECT Artikel, Anzahl,Fehlerart, " _
 & " Bemerkung " _
 & " FROM tbl_sub " _
 & " WHERE ID_sub = " & Me.ID_main & "" _
 & " ORDER BY tbl_sub.Artikel"
 
 
 
 
 Set rst = CurrentDb.OpenRecordset(sSQL, dbOpenSnapshot)
 
 
 
 
 'Build HTML Output for the DataSet: Tabelleninhalt
 strTableBody = strTableBeg & strFntNormal & strTableHeader
 
 Do Until rst.EOF
 strTableBody = strTableBody & _
 "
 " & _ "TD(rst!Artikel) & _
 TD(rst!Anzahl) & _
 TD(rst!Fehlerart) & _
 TD(rst!Bemerkung) & _
 "
 
 
 rst.MoveNext
 Loop
 
 
 'Totals
 strTableBody = strTableBody & _
 "
 "| Gesamtsumme" & _ | "
 
 
 
 strTableBody = strBody & strTableBody & strFntEnd & strTableEnd
 
 rst.Close
 
 'Create e-mail item
 Set olApp = Outlook.Application
 Set objMail = olApp.CreateItem(olMailItem)
 With objMail
 'Set body format to HTML
 .To = Me!EMail_Adressen
 .Subject = "Fehler: " & Me!HU & " und Datenbank-ID " & Me!ID_main
 .BodyFormat = olFormatHTML
 .HTMLBody = "<body>" & strFntNormal & strTableBody & "
 | 
 |