Author |
|
guyfromnola Newbie
Joined: 31 July 2008 Location: United States
Online Status: Offline Posts: 2
|
Posted: 31 July 2008 at 12:16pm | IP Logged
|
|
|
I am running a contact management program on MS Access and ASP. I have a 'contacts' table in the database. For each contact record, there are options to classify that person by their involvement in our organization. For example, after all of the contact details are added, there is a section of yes/no boxes to check off whether they participate in certain activities. So if someone is involved in say activity A, C, and G, then those boxes are selected. In my email form, I would like to give the user the capability of only being able to send emails via group classification.
When a database user goes to the email page, I would like the 'To:' section to simply be a list of check boxes identical to the list they are presented with when adding a contact. When sending an email pertinant to a certain activity or a select handful of activities, they can check off the boxes of which people classified by that group should receive the email.
I know there needs to be some code referencing the tables such as...
SELECT * FROM _contacts WHERE xyz is true...etc
but I'm not sure how exactly to implement this. Any help would be greatly appreciated.
Thanks
|
Back to Top |
|
|
Andrew AfterLogic Support
Joined: 28 April 2006 Location: United States
Online Status: Offline Posts: 1189
|
Posted: 01 August 2008 at 1:04am | IP Logged
|
|
|
Actually, this is a database related task which should be rather asked on an SQL forum.
There should be two queries:
- build list of recipients with checkboxes;
- obtain list of recipients for sending.
Let's imagine your table has the following fields:
id - record unique ID (primary key);
name - contact's name;
email - contact's e-mail address;
involvedA - flag indicating the contact is involved to activity A;
involvedB - .... B;
involvedC - .... C;
involvedD - .... D;
You need to build the list of recipients which are involved to A, C, D, then the query would look like:
SELECT id, name FROM _contacts WHERE involvedA = 1 AND involvedC = 1 AND involvedD = 1
This query would return a list of IDs and names:
Code:
10 John Doe (johndoe@domain.com)
41 Bobby (bobby@world. com)
77 Mary (mary@test.com)
78 Peter (peter@test.c om) |
|
|
Let's say the user checked the following recipients: 10, 77, 78, then you should submit the list of these IDs to server (avoid passing e-mail addresses or other text data) and obtain the list of e-mail addresses to send:
SELECT email FROM _contacts WHERE id IN (10, 77, 78)
Best regards,
Andrew
|
Back to Top |
|
|
guyfromnola Newbie
Joined: 31 July 2008 Location: United States
Online Status: Offline Posts: 2
|
Posted: 01 August 2008 at 1:23pm | IP Logged
|
|
|
Andrew, thanks so much for your help with this. I'll get working on it.
Garrett
|
Back to Top |
|
|