Copy subform data to clipboard for pasting to e-mail program

N

Nelson

From a contact management application (Access 2000) I want the user to be
able to be able to paste a string of e-mail addresses into her e-mail program
of choice.

I hope to generate the string from the click of a command button on the main
form. eg. "(e-mail address removed); (e-mail address removed)"

The e-mail addresses come from a subform.

If I am going about this correctly, I would first create a SELECT statement
isolating the e-mail addresses, then concatenate them and separate them with
a semi-colon. Then I would insert the variable into some code I found which
copies data to the clipboard (KB item #138909 &
http://www.mvps.org/access/api/api0049.htm)

First I've not been able to create a proper SELECT statement in code.

Dim rst As DAO.Recordset
Dim strTo As String
Dim id As Integer

Set rst = CurrentDb.OpenRecordset("SELECT Email FROM tblPerson WHERE
Email is not" _
& "null AND PersonID =" & Str([Me!fsubListPerson.Form!PersonID]) &
";")

With rst
Do Until .EOF
strTo = strTo & rst() & ";"
.MoveNext
Loop
.Close
End With

strTo = Left(strTo, Len(strTo) - 1)
Set rst = Nothing

'[snip]

The error I receive is "ARHAP_UCT can't find the field "|" referred to in
your expression." ARHAP_UCT is the database name. Email field is Text;
PersonID is Long/Autonumber.

Thanks much! I've been trying to solve this for days and am finally
resorting to this post.

-Nelson Fredsell
Cape Town, South Africa
 

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