Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

e-mail automation... including query results 1

Status
Not open for further replies.

shanedavid1981

Programmer
Joined
Feb 3, 2005
Messages
54
Location
US
I have automated an e-mail process in access that will e-mail certain people requesting login activation, but I need the login list from a query including in this email...

how can i do this?

:o)
 
Hi, shanedavid1981,

Several ways to approach this. If the list is not too long, I would probably iterate through the query's recordset and build a text string to add to the body of the e-mail. Here's some air code that you could include with your e-mail routine that might get you pointed in the right direction:
Code:
Dim strMyList As String
Dim db As DAO.Database
Dim rs As DAO.Recordset

Set db = CurrentDb
Set rs = db.OpenRecordset("[blue]qryMyQuery[/blue]")

If rs.RecordCount > 0 Then
    While Not rs.EOF
        strMyList = strMyList & rs![blue]loginIDfield[/blue] & vbCrLf
        rs.MoveNext
    Wend
    strMyList = Left(strMyList, Len(strMyList) - 1)
    [green]'now you can use strMyList in your e-mail[/green]
End If

rs.Close
Set db = Nothing
HTH,

Ken S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top