Re: Email Cmd
- From: John Nurick <j.mapSoN.nurick@xxxxxxxxxxxxxx>
- Date: Tue, 23 Aug 2005 19:33:03 +0100
One possibility, of course, is to make a little report based on the
query, so it includes the recipient's name and lists the items; then use
DoCmd.SendObject to send the report.
Otherwise you need to build a string containing the data returned by the
query. Assuming the query returns one record per overdue item, with one
field per record, you could do something like this:
....
Dim rsOverdueItems As DAO.Recordset
Dim strOverdueItems As String
Set rsOverdueItems = CurrentDB.OpenRecordset( _
"qryOverdueItems", dbSnapshot)
With rsOverdueItems
Do Until .EOF
strOverdueItems = strOverdueItems & Fields(0).Value _
& vbCrLf
.MoveNext
Loop
.Close
End With
....
strMessage = "The following items are overdue to the DSL." _
& vbCrLf & vbCrLf & strOverdueItems & vbCrLf
DoCmd.SendObject ...
On Tue, 23 Aug 2005 09:45:01 -0700, "Katayon"
<Katayon@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>I have a Command that generates an email message as follows:
>
>Private Sub cmdSendOverdue_Click()
>
>Dim strMessage As String 'Body of message
>Dim strSubject As String 'Email Subject
>Dim strTo As String 'To address
>strTo = "TEST"
>strSubject = "DSL Overdue Items"
>
>strMessage = "The following items are overdue to the DSL." & vbCrLf & vbCrLf
>strMessage = strMessage & "" & qryOverdueItems & vbCrLf & vbCrLf
>
>DoCmd.SendObject acSendNoObject, , acFormatHTML, strTo, , , strSubject,
>strMessage, True
>
>End Sub
>
>The issue is, I would like to list the query/table qryOverdueItems, as
>attempted in the second 'strMessage' above.
>Unfortunetly, this is not working. How can I get the above email message to
> display the entire results of the query (basically be able to list an entire
>table).
>
>Is this possible?
>
>Thanks in advance for your help.
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
.
- Follow-Ups:
- Re: Email Cmd
- From: Katayon
- Re: Email Cmd
- References:
- Email Cmd
- From: Katayon
- Email Cmd
- Prev by Date: RE: opening a form from another form in data*** view
- Next by Date: Re: How Can I Pre-Process Data in a Bound Control?
- Previous by thread: Email Cmd
- Next by thread: Re: Email Cmd
- Index(es):