URGENT - Emailing multiple list box items from ms access using Lotus Notes

  • Thread starter Thread starter Rups
  • Start date Start date
R

Rups

Hello

I am using Ms Access to send email automatically through Lotus Notes.
What I require now is that I have a List Box in my form which when
loads,fills in the data's from the backend table.
In the body of the mail,I use the object that contains the item
selected from the list.
i.e. MailDoc.Body=ListBox225.Column(0) & List225.Column(1)
When an email is generated,it output is as below.

126 Rupam.

Now I want a syntax code that would include multiple rows from the list
box and not just 1 row.

Please can you help me with this I am in desparate need of it.

Your help much appreciated.

Regards
Rupam.
 
Dim strMessage As String
Dim varSelection As Variant

For Each varSelection In ListBox255.ItemsSelected
strMessage = strMessage & ListBox225.Column(0, varSelection) &
List225.Column(1, varSelection) & ", "
Next varSelection

If Len(strMessage) > 2 Then
strMessage = Left$(strMessage, Len(strMessage) - 2)
End If

MailDoc.Body = strMessage

That will separate each selected item with a comma and space. If you want
each to be on a separate line, replace the & ", " with & vbCrLf.
 
Thanks Douglas,

U r genius.

Also can you help me out with a vb code where I can send email from MS
Access usig Lotus Notes which contains an attachments(excel) but all at
the click of a button.

Sample which I am using is as below.

Private Sub Command23_Click()

Dim varRecip As String
Dim strBody() As Variant
Dim blnSaveIt As Boolean
Dim stWho As String
Dim stFrom As String


On Error GoTo Err_Handler

Dim Maildb As Object
Dim UserName As String
Dim MailDbName As String
Dim MailDoc As Object
Dim Session As Object
Dim EmbedObj As Object

varRecip = "(e-mail address removed)"
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, _
(Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set Maildb = Session.GETDATABASE("", MailDbName)
If Maildb.ISOPEN = False Then
Maildb.OPENMAIL
End If
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.Sendto = varRecip
MailDoc.Subject = "" & CustTypeCombo & " - " & VendorID & "-" &
QueryNo & "-"
&txtUser
MailDoc.Body = "From : " & txtUser & Chr$(13) & Chr$(13) & "Call
Date : " & CallDate & Chr$(13) & Chr$(13) & "Query Number :" & QueryNo

MailDoc.PostedDate = Now()
MailDoc.send False, varRecip


Exit_Here:
On Error Resume Next
Set Maildb = Nothing
Set MailDoc = Nothing
'Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing

Exit Sub

Err_Handler:
MsgBox Err.Number & ": " & Err.Description
Resume Exit_Here

End Sub
____________________________________________________________________
 

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

Back
Top