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
3 4423
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 -
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.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"
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 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:
|
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".
|
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
|
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...
|
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...
| |
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
|
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...
|
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...
|
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()
|
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...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
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();...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |