Using email address from table with sendobject

Using email address from table with sendobject

am 21.10.2007 22:36:21 von Owen Mac

Hello everyone,

Is it possible to use an email address from a table and/or query with
the Sendobject Method.
An email address from my form works fine...what I would like is the
'To:' section be filled from a query I have.

DoCmd.SendObject acReport, stDocName, acFormatRTF, _
"email address here", , [Forms]![frmStudents]![Email],,

Cheers,
-Owen Mac

Re: Using email address from table with sendobject

am 22.10.2007 12:16:03 von Bob Darlington

Owen,
If you build a recordset on your query, you can loop through it and build
your 'strAddress' string.
I use something like:

With rs
Do Until .EOF
If strAddress = "" Then
strAddress = !Email
Else
strAddress = strAddress & ";" & !Email
End If
.MoveNext
Loop
End With

If strAddress <> "" Then SendMessage(True, strAddress, "", "", 1, "",
"", "", "")
--
Bob Darlington
Brisbane
"Owen Mac" wrote in message
news:13hne11sk0l5q0e@corp.supernews.com...
> Hello everyone,
>
> Is it possible to use an email address from a table and/or query with the
> Sendobject Method.
> An email address from my form works fine...what I would like is the 'To:'
> section be filled from a query I have.
>
> DoCmd.SendObject acReport, stDocName, acFormatRTF, _
> "email address here", , [Forms]![frmStudents]![Email],,
>
> Cheers,
> -Owen Mac

Re: Using email address from table with sendobject

am 22.10.2007 12:17:29 von NewsGuy

"Owen Mac" wrote in message
news:13hne11sk0l5q0e@corp.supernews.com...
> Hello everyone,
>
> Is it possible to use an email address from a table and/or query with the
> Sendobject Method.
> An email address from my form works fine...what I would like is the 'To:'
> section be filled from a query I have.
>
> DoCmd.SendObject acReport, stDocName, acFormatRTF, _
> "email address here", , [Forms]![frmStudents]![Email],,
>
> Cheers,
> -Owen Mac

You can use any field from a table with any other bit of code...

Dim rs as adodb.recordset
Set rs = new adodb.recordset

strSql = "Select * from tblStudents"
rs.open strSql, currentproject.connection, 1 , 1 <--its been a while so the
i dont recall the enums for these last to values...
do while not rs.eof
docmd.sendObject acReport, stDocName, acFormatRTF, rs!emailAddress, etc
rs.movenext
loop
rs.close
set rs = nothing


Thats off the top of my head and im a bit rusty so there could be errors
above...
You will have to set the filter of the report too
....and it could all be wrong.. :)

John