Report results in Email

S

SandySun

I have a Query with Email addresses and another Query with account numbers
and dollar amounts. Does anyone know how to insert the data from the Query
with account numbers so that it goes to the individual email address? Thanks
in advance for your help.

Sandy
 
M

MGFoster

SandySun said:
I have a Query with Email addresses and another Query with account numbers
and dollar amounts. Does anyone know how to insert the data from the Query
with account numbers so that it goes to the individual email address? Thanks
in advance for your help.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use VBA to set up the query & run it. Ex:

The user clicks a button that "Gets the Pricing."

Private Sub cmdGetPricing_Click()

Dim db AS DAO.Database, qd As DAO.QueryDef
Dim dteStart As Date, dteEnd As Date
Dim strSQL As String

' Get the variables from the user
dteStart = InputBox ("Begin Date? ")
dteEnd = InputBox("End Date? ")

' Set up T-SQL call to stored procedure (SP) w/ variables
strSQL = "exec sp_GetPricing " & Format(dteStart,"yyyy-mm-dd") & _
"," & Format(dteEnd, "yyyy-mm-dd")

' Set up the pass-thru query (it calls an SP)
Set db = CurrentDB
Set qd = db.QueryDefs("BlankQuery")
with qd
.SQL = strSQL
' Run the pass-thru query
.Execute
end with

' Clean up
Set qd = nothing
Set db = nothing

End Sub

This needs an error handling routine.

The query "BlankQuery" is a stored query w/o anything set up (actually,
it has something in it, but it doesn't have to mean anything).

HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBR8Y8TIechKqOuFEgEQIhnACdEfzP5uNMGD9yC9jW4BfOMtR7mDoAoPDE
ZR34IAJ/UGmoLnfaLeMTGTLl
=KfMW
-----END PGP SIGNATURE-----
 
S

SandySun

thanks MG......do you know how to get the results to populate the body of an
email?
 

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