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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Generating Emails

Status
Not open for further replies.

Shadez

Programmer
Jul 5, 2001
57
US
Ok fairly new to the actual programming aspect of access. So please try and be user friendly with an answer :) I will probably give useless info here, I think it's better to give to much info then to little.

I have a query set that lets me filter records according to project #. So at the time of running it if I type in 3813 for a project number. I get only members that have interest in that project populating the form.

So here I am looking at a form that gives me all this useful information. Now I need a way to get the email names into a program that can use them.

Few ways to attempt this and I would love suggestions/solutions to this problems.

1) Open outlook populating it with email names in the mailto field.

2) Put all the email messages into a text delimited list, that is put directly into the clipboard.

Please give a detailed description on how to accomplish either of these tasks. As I sais I am very new to the programming aspect of this but I am very eager to learn.


Thanks in advance
 
I'm not exactly sure what you're asking, but I think you are asking how to send an email based on a query to different individuals. You can use the DoCmd.SendObject method to send an email to anyone on your Outlook global address list based on the contents of a table or query. This is a template you can use:

DoCmd.SendObject acSendQuery, "qryProject", acFormatTXT, _
"John Smith; Jane Doe", "Jane Smith", , _
"Project Information", , False

acSendQuery = type of object you are sending
"qryProject" = name of object you are sending
acFormatTXT = send the query as a text file
"John Smith..." = who you are sending email to
"Jane Smith" = Who you are CC:
"Project Information" = title for the email
 
Thanks for the response. OK I knew I would not explain it good enough my fault let me elaborate. The emails are contained in a field called "member_email". A query or sql string will be used to filter only those addresses that fit my needs. So what i need is a way to run this from a command button.

Hit command button, I get prompted for the criteria limiter. Since this limiter is people involved in this project I have no need to verify the listing as all thethave veiwed this project need to recieve this mail.

Viewers of the project are contained in a linking table bidders. Which has publickey and Project key. Project Key being the link to project info. Public key being the important factor this links to the members table. The mebers table contains the email adresses.

So Basically I will be using a join to find out what memebers looked at project 2839 and then pulling the email address from Members table. I then need the email address placed in the to field of a new outlook message.
 
Ok by scoaring other topics I came up with this. This pulls all the emails out of the table. Now I just need a way to prompt the user for a project number so that the results are filtered.


Private Sub Command0_Click()

Set db = CurrentDb
SQL = "SELECT * FROM users;"
Set rs = db.OpenRecordset(SQL)

rs.MoveFirst

Do While rs.EOF = False
Email = Email & rs!Email & ";"
rs.MoveNext
Loop


If Email = "" Then
MsgBox "There are currently no client records listed under this category", vbExclamation, "E-Mail Error"
Exit Sub
End If

DoCmd.SendObject acSendNoObject, , , , , Email, , , , True

End Sub
 
Shadez:

Regarding your question about prompting the user for the project #: Why not add the parameter in the initial query under the criteria for Project# (e.g. "[Enter the project number]")? Or put an inputbox in your code.

Will you let me know how this is working for you. I saw what looked to be a better solution, and I will look for it and pass it onto you if I can find it. If you're interested , send me your email address.

Thanks

Scott Graham
grahamag@erols.com
 
otto,

Yeah that was my first impression, being fairly new to the coding portion though i was happy geting the mails going in. I then Modified the sql , I created a query that did prompt user for project number. I then cut and paste the sql into the code. I began getting errors on the sql code though. My guess was that there is a different way to prompt for user input through the code.

BTW if you find a better way toi accomplish this please pass it on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top