Hi all,
I created a listbox with employees' names and email addresses in it, and a button which grabs email address once it's clicked. Currently I can only pick up one address at a time, but I also want to be able to grab multiple addresses. My code is as follows:
Private Sub SendCommand_Click()
Dim strName As String
Dim strEmail As String
strName = Me.List45.Column(0)
strEmail = Me.List45.Column(1)
DoCmd.SendObject acSendNoObject, "None", acFormatHTML, strEmail
End Sub
This can only pick up one email address when I look up the listbox and click the button. Can anyone show me how to grab multiple addresses?
Thanks a bunch,
zg
3 4403
Hi all,
I created a listbox with employees' names and email addresses in it, and a button which grabs email address once it's clicked. Currently I can only pick up one address at a time, but I also want to be able to grab multiple addresses. My code is as follows:
Private Sub SendCommand_Click()
Dim strName As String
Dim strEmail As String
strName = Me.List45.Column(0)
strEmail = Me.List45.Column(1)
DoCmd.SendObject acSendNoObject, "None", acFormatHTML, strEmail
End Sub
This can only pick up one email address when I look up the listbox and click the button. Can anyone show me how to grab multiple addresses?
Thanks a bunch,
zg
This bit should get you pointed in the right direction -
For Each x In List0.ItemsSelected
-
If strAddress = "" Then
-
strAddress = List0.ItemData(x)
-
Else
-
strAddress = strAddress & "; " & List0.ItemData(x)
-
End If
-
Next x
-
If Nz(strAddress, "") = "" Then
-
MsgBox "You must select an e-mail recipient"
-
Exit Sub
-
End If
-
This can be easily done throuugh following code
Private Sub testmultiselect_Click()
Dim oItem As Variant
Dim sTemp As String
Dim iCount As Integer
iCount = 0
If Me!Nameslist.ItemsSelected.Count <> 0 Then
For Each oItem In Me!Nameslist.ItemsSelected
If iCount = 0 Then
sTemp = sTemp & Me!Nameslist.ItemData(oItem)
iCount = iCount + 1
Else
sTemp = sTemp & ";" & Me!Nameslist.ItemData(oItem)
iCount = iCount + 1
End If
Next oItem
Else
MsgBox "Nothing was selected from the list", vbInformation
Exit Sub 'Nothing was selected
End If
Me!mySelections.Value = sTemp
End Sub
Private Sub clrList_Click()
Call clearListBox
Me!mySelections.Value = Null
End Sub
However, you have to create following fields & commands button also as follows:
List Box
----------------------------------------------------
Name : NamesList
Row Source Type : Table/Query
Row Source : SELECT Email FROM Employees
Multi Select : Extended
Width : 3.5"
Height : 0.75"
Text Box
-----------------------
Name : mySelections
Width : 3.5"
Height : 0.25"
Command Button
----------------------------------
Name : testmultiselect
Caption : Display Selected Items
Width : 1.375"
Height : 0.3"
Command Button
----------------------
Name : ClrList
Caption : Clear List
Width : 1.375"
Height : 0.3"
to select multiple address I use a sub form in datasheet view with a bolean field where the bolean is true you use those addresses with that and the code left above you should be able to do what you want unless I completely misunderstood the ?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jonathan Levy |
last post by:
We have SQL Server 2000 Standard and recently moved from Exchange 5.5
to Exchange 2003. This problem occurred both before and after the
e-mail change.
We would like to send notifications of...
|
by: (Pete Cresswell) |
last post by:
For better or worse, I have chosen to implement mailing addresses in a
particular application as a separate table. One Person ==> Many Addresses.
It is a database for managing school reunions...
|
by: Jen |
last post by:
Trying to take one table in access and split it into multiple excel
files(using an excel template); and then email based on email
addresses in Table2; Of course, I would like to do all of this...
|
by: .Net Newbie |
last post by:
Hello,
I am currently coding my ASP.Net pages in c# and have run into a question
concerning Emails. I have four objects on a page (six including 2 buttons).
The first is a subject line...
|
by: Michelle |
last post by:
Hi
Is it possible/anyone know how to send a document (.pdf) to multiple
recipients using POP where the email is not just a matter of throwing 1000
email addresses in the BCC list, but each email...
|
by: Bernard Lebel |
last post by:
Hello,
Is there an option or a way to allow the selection of multiple entries
in the Listbox widget? I could not find any, and would like to allow
the end user to select multiple entries.
...
|
by: fstenoughsnoopy |
last post by:
I have a customer order database and I need to pull a customers
information, ie first name, last name, address, city, state, zip,
phone, etc, into the oder table. i don't know how to go about...
|
by: Marisa |
last post by:
Hi. I am new to C#, and I am having trouble getting the multiple
selection of listbox to work. I have an asp.net web form, and I need
two listboxes which are filled with an access table. I have...
|
by: micarl |
last post by:
How would i print a report based on criteria selected from several
Combo Boxes as well as multiple Multi Select List Boxes, that are
located on the same form?
I can get one Multi List Box, just...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |