Jeg er med på metoden med at vælge een modtager som i dit eksempel, men mit behov går ud på at jeg umiddelbart efter afslutning af en større programopdateringsrutine, skal have programrutinen til at afslutte med at udsende en lille besked til samtlige brugere om at data er opdateret
Det er 58 jeg sigter på. med i 58 kan du også vælge alle på listen. Det må kunne automatiseres, så db selv udfører opgaven med et call til en funktion.
Jeg så helst at jeg undgik din "mellemformular" ... kan ikke lige se hvordan jeg får det automatiseret :-(
Synes godt om
Slettet bruger
03. april 2008 - 11:24#9
Prøv!~)
dim db as dao.database dim rst as dao.recordset set db = currentdb() set rst = db.openrecordset("NavnPåDinTabelEllerForespørgsel") with rst .movefirst do DoCmd.SendObject , , , !NavnPåEmailFelt, , , "Data er opdateret.." .movenext loop until .eof .close end with
Dim MyDB As Database Dim MyRS As Recordset Dim objOutlook As Outlook.Application Dim objOutlookMsg As Outlook.MailItem Dim objOutlookRecip As Outlook.Recipient Dim objOutlookAttach As Outlook.Attachment Dim TheAddress As String
Dim Message1 As String Dim Message2 As String
On Error Resume Next
Message1 = "The Management Flash DataWarehouse-application updated up until : " & _ DLookup("[ReportDate]", "tblLastUpdate")
Message2 = "Auto-Genereted message." & Chr(10) & Chr(10) & _ "Please do not reply directly to this message."
Set MyDB = CurrentDb Set MyRS = MyDB.OpenRecordset("tblMailingList") MyRS.MoveFirst
' Create the Outlook session. Set objOutlook = CreateObject("Outlook.Application")
Do While Not MyRS.EOF ' Create the e-mail message. Set objOutlookMsg = objOutlook.CreateItem(olMailItem) TheAddress = TheAddress & MyRS![EmailAddress] & ";" MyRS.MoveNext Loop
With objOutlookMsg ' Add the To recipients to the e-mail message. Set objOutlookRecip = .Recipients.Add(TheAddress) objOutlookRecip.Type = olTo
' Set the Subject, the Body, and the Importance of the e-mail message. .Subject = Message1 .Body = Message2 .Importance = olImportanceHigh 'High importance
'Add the attachment to the e-mail message. If Not IsMissing(AttachmentPath) Then Set objOutlookAttach = .Attachments.Add(AttachmentPath) End If
' Resolve the name of each Recipient. For Each objOutlookRecip In .Recipients objOutlookRecip.Resolve If Not objOutlookRecip.Resolve Then objOutlookMsg.Display End If Next .Send End With ' MyRS.MoveNext 'Loop Set objOutlookMsg = Nothing Set objOutlook = Nothing
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.