Ok, so in this db that I have, there is a field known as "Status", the selections are "Closed, Open, Returned for Correction, and a few others".
What I'm trying to do is when the user selects "Closed", the database will ask a question to the user of "Would you like to send the contact an email to tell them that their document is ready to be picked up?"
There is a field on the form where the person can put in the contact name which is where this would come from. The user has another form where the contact informatio would be in, ie: Name, Phone, Location, eMail address.
I am trying so that if the user selects, "Yes", MS Outlook would open a new email from their account with that users email address pulled in from the DB.
Ok, so I've got the module I need to send the task to email, using MS Outlook on that users account. I've tested that (just running the module) and it'll work.
The only thing I'm trying to figure out now is:
1. How to input the data from that particular task (ie: the data that is say on Task #1, much like the "print current record") to be put in the snapshot of the report that I did.
2. Insert the users email which is put into the database as the default "To:"
Dim doc_name As String
Dim email_title As String
doc_name = "rptTask"
email_title = "Ready for Pick-up"
DoCmd.SendObject acSendReport, doc_name, "SnapshotFormat (*.snp)", "", "", "", email_title, "", True, ""
2) Not sure where the email address is. If it's on the form, you can simply refer to it: Me.EmailAddress
Thanks! So I'm going to try to add "Task.ID.=??" to print the current record to a snapshop viewer and email it.
The second question, the email address resides in a different table but the users name (First and Last) is on the main form (Task.Log). I'm going to take a look at that code which puts the user's name in that location because I know the "Contact ID" (primary key for the contact table which contains the email address) is on that just hidden from view. So I'll try to pull that into the email.
Sorry for the delay, I didn't get an email notification of your post. Yes, that does sound like a plan. If you can't get the email on the form it sounds like you could use a recordset or DLookup to get it using the user name as criteria.
Ok, so the code that I put in the above post works for opening an email.
The thing that I'm stuck on is how to pass the email address from the contact on my main form into the "To" line of the email.
There is two things that happen:
1. The user double-clicks in the field and it'll open another form where the user can search for the contact to add into the location. After they double-click or select the one they want to add, it passes a value (ContactID) to the main form in a box. Code for that is: