Pulling email addresses from a DB, then sending the email

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Monroeski
    New Member
    • Aug 2007
    • 30

    Pulling email addresses from a DB, then sending the email

    I am working on a form for approval/disapproval of requests. Basically, the user will select a RequestID from a combobox, then select approve or disapprove, then hit the submit button. When they hit submit, I want to

    1. Update the DB (which I have already implemented), then
    2. using the RequestID, determine the two related email addresses (let's say Email1 and Email2) attached to the relevant ServiceID.

    This sounds odd to me, but though I have done a good number of update queries, select queries to populate combo boxes, and a few other things, I haven't had to pull a particular field value from a query individually before and I'm not totally sure where to start.

    I have no trouble putting together the actual SQL queries and everything, I'm just not sure how to manipulate the data to pull those two email addresses out individually.
  • JustJim
    Recognized Expert Contributor
    • May 2007
    • 407

    #2
    Originally posted by Monroeski
    I am working on a form for approval/disapproval of requests. Basically, the user will select a RequestID from a combobox, then select approve or disapprove, then hit the submit button. When they hit submit, I want to

    1. Update the DB (which I have already implemented), then
    2. using the RequestID, determine the two related email addresses (let's say Email1 and Email2) attached to the relevant ServiceID.

    This sounds odd to me, but though I have done a good number of update queries, select queries to populate combo boxes, and a few other things, I haven't had to pull a particular field value from a query individually before and I'm not totally sure where to start.

    I have no trouble putting together the actual SQL queries and everything, I'm just not sure how to manipulate the data to pull those two email addresses out individually.
    Hi,
    So your SQL would be something like
    [CODE=vb]SELECT ServiceTable.Em ail1, ServiceTable.Em ail2
    FROM RequestTable INNER JOIN ServiceTable ON RequestTable.Re questID = ServiceTable.Se rviceTableForei gnKey
    WHERE RequestTable.Re questID = <the combo-box selection>[/CODE]
    and you open a recordset (rs) based on that SQL

    You then reference the Email addresses by
    rs!Email1 and rs!Email2

    And the bit you didn't ask, but is obvious from the title, you then use the SendObject method of the DoCmd object (watch the second-last option of the SendObject method, Edit or not edit, some network security settings get scared if you try to send email programatically without opening the email client.

    Good luck and ask again if you need.

    Jim

    Comment

    • Monroeski
      New Member
      • Aug 2007
      • 30

      #3
      Got it, thanks. I actually figured out a somewhat ridiculous workaround, but your way is better.

      And I didn't mention about the SendObject method because I already had that part figured out. ; )

      Comment

      Working...