Drag and Drop, then Email

G

Guest

I have a drag and drop interface so that the user can select one or more
names from an unbound list box (List1) and move them to another unbound list
box (List2). (They can also drag and drop from List2 to List1.)

Once the user drags some or all names from List1 to List2, I would then like
the user to be able to click on a command button which will open Outlook and
populate the To: box with the emails of the people in List2.

If I can string together the emails in List2, and then copy this text string
into a hidden unbound text box (txtSelected), I’ll be in good shape because I
can just put this behind the email command button:

Private Sub cmdEmail_Click()
Dim strEmail As String
strEmail = Me.txtSelected & vbNullString

DoCmd.SendObject To:=strEmail
End Sub

I’m just not sure how to extract the email values from List2 and string them
together. One potential problem (or maybe not) is that the bound column in
List2 is *not* the email value. Instead, it’s PersonID. This is required for
the drag and drop feature to work in both directions.

Here’s the rowsource of List2:

SELECT tblPeople.PersonID, tblPeople.LName, tblPeople.Email
FROM tblPeople
WHERE (((tblPeople.ysnSelected)=True)
AND ((tblPeople.Status)="1")
AND ((tblPeople.DoNotContact)=False))
ORDER BY tblPeople.LName;

###

Any ideas? Thank you.

Kurt
 
R

Rob Parker

You can refer to the email field via the Column property of the listbox.
The index is zero-based, so in your case, to get the email field, you would
use .Column(2).

HTH,

Rob
 

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

Top