melody.anne
Registered User.
- Local time
- Today, 04:28
- Joined
- Feb 27, 2015
- Messages
- 43
I have this code that should loop through a query and populate the "Send To" field based on selected values in list boxes:
I am not sure if it is working as my work computer will not allow me to set up an Outlook profile. They want to send mail using Lotus Notes 8.5, for which I have found this code:
My question being, how can I incorporate these together, so that instead of Outlook, my e-mails are sent through Lotus Notes but loop and select e-mail addresses using something like the first code?
Code:
Private Sub Command39_Click()
Dim MyDb As DAO.Database
Dim rsEmail As DAO.Recordset
Dim sToName As String
Dim sSubject As String
Dim sMessageBody As String
Set MyDb = CurrentDb()
Set rsEmail = MyDb.OpenRecordset("qryNames", dbOpenSnapshot)
With rsEmail
.MoveFirst
Do Until rsEmail.EOF
If IsNull(.Fields(2)) = False Then
sToName = .Fields(2) '2 is the field where e-mails are stored
sSubject = "Invoice # : "
sMessageBody = " "
DoCmd.SendObject acSendNoObject, , , _
sToName, , , sSubject, sMessageBody, False, False
End If
.MoveNext
Loop
End With
Set MyDb = Nothing
Set rsEmail = Nothing
End Sub
I am not sure if it is working as my work computer will not allow me to set up an Outlook profile. They want to send mail using Lotus Notes 8.5, for which I have found this code:
Code:
[FONT=Courier New]Dim notesdb As Object[/FONT]
[FONT=Courier New]Dim notesdoc As Object[/FONT]
[FONT=Courier New]Dim notesrtf As Object[/FONT]
[FONT=Courier New]Dim notessession As Object[/FONT]
[FONT=Courier New]Set notessession = CreateObject("Notes.Notessession")[/FONT]
[FONT=Courier New]Set notesdb = notessession.getdatabase("", "")[/FONT]
[FONT=Courier New]Call notesdb.openmail[/FONT]
[FONT=Courier New]Rem make new mail message[/FONT]
[FONT=Courier New]Set notesdoc = notesdb.createdocument[/FONT]
[FONT=Courier New]Call notesdoc.replaceitemvalue("Sendto", strSupportEMail)[/FONT]
[FONT=Courier New]Call notesdoc.replaceitemvalue("Subject", "Problem Report")[/FONT]
[FONT=Courier New]Set notesrtf = notesdoc.createrichtextitem("body")[/FONT]
[FONT=Courier New]Call notesrtf.appendtext("Problem Report")[/FONT]
[FONT=Courier New]Call notesrtf.addnewline(2)[/FONT]
[FONT=Courier New]Rem attach Error Report doc[/FONT]
[FONT=Courier New]'s = ActiveDocument.Path + "\" + ActiveDocument.Name[/FONT]
[FONT=Courier New]Call notesrtf.embedObject(1454, "", strCurrentPath, "Mail.rtf")[/FONT]
[FONT=Courier New]Rem send message[/FONT]
[FONT=Courier New]Call notesdoc.Send(False)[/FONT]
[FONT=Courier New]Set notessession = Nothing[/FONT]
My question being, how can I incorporate these together, so that instead of Outlook, my e-mails are sent through Lotus Notes but loop and select e-mail addresses using something like the first code?