473,725 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to grab multiple email addresses using listbox?

1 New Member
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_Cli ck()

Dim strName As String
Dim strEmail As String


strName = Me.List45.Colum n(0)
strEmail = Me.List45.Colum n(1)

DoCmd.SendObjec t 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
Aug 23 '07 #1
3 4423
JConsulting
603 Recognized Expert Contributor
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_Cli ck()

Dim strName As String
Dim strEmail As String


strName = Me.List45.Colum n(0)
strEmail = Me.List45.Colum n(1)

DoCmd.SendObjec t 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
Expand|Select|Wrap|Line Numbers
  1. For Each x In List0.ItemsSelected
  2. If strAddress = "" Then
  3.    strAddress = List0.ItemData(x)
  4. Else
  5.     strAddress = strAddress & "; " & List0.ItemData(x)
  6. End If
  7. Next x
  8. If Nz(strAddress, "") = "" Then
  9. MsgBox "You must select an e-mail recipient"
  10. Exit Sub
  11. End If
  12.  
Aug 24 '07 #2
Sanjaylml
31 New Member
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.It emsSelected.Cou nt <> 0 Then
For Each oItem In Me!Nameslist.It emsSelected
If iCount = 0 Then
sTemp = sTemp & Me!Nameslist.It emData(oItem)
iCount = iCount + 1
Else
sTemp = sTemp & ";" & Me!Nameslist.It emData(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"
Aug 24 '07 #3
MGrowneyARSI
90 New Member
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 ?
Aug 24 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3235
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 failed jobs to multiple people in case one person happens not to be in on the day there is a problem. Setting up an operator with an e-mail name that combines two addresses seems to work ok as long as we use a format like the following:
2
2839
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 and people really do have multiple (summer/winter, for instance) mailing addresses. I'd also like to keep track of people's defunct addresses. To that end, "tblAddress".
2
6678
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 with minimum user-interface...If there is anyone out there that can help... please feel free to share!:) PS... Using MSOffice 2000 Example: Table1
2
8835
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 (textbox) , the next is the email body (a Textbox with multiple rows), an email address (textbox), and a DropDownList containing multiple email addresses (populated from a SQL Server table). The way this page functions is that a user types in the email...
4
5624
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 is addressed personally.. ie: dear Harry... I need to generate a subset of people via a query who have authorised to receive information via email. Get those email addresses into outlook, attach the document and then (if possible) personalise...
3
11275
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. Thanks Bernard
6
8369
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 making this work...
1
2767
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 to be able to select multiple items, and fill a datagrid with the results. I can fill 2 listboxes and a datagrid, but not with multiple selections. So far, I have no code behind, I have completed it with just using the characteristics of the...
12
4044
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 not several, to report using this code i found - Private Sub cmdPreview_Click()
0
8889
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9257
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9179
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9116
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8099
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6011
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.