By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,475 Members | 1,929 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,475 IT Pros & Developers. It's quick & easy.

email address as string

P: 20
I have searched this form and did google and yahoo but to no avail. I'm trying to send a report via email to email addresses listed in the report but Iím not getting anywhere. This is what I have so far....
Expand|Select|Wrap|Line Numbers
  1. Function Macro1()
  2. On Error GoTo Macro1_Err
  3. Dim strSendTo As String
  4. strSendTo = ProjectManagerEMail
  5.  
  6.     DoCmd.SendObject acReport, "month", "SnapshotFormat(*.snp)", strSendTo, "", "", "", "", False, ""
  7.  
  8.  
  9. Macro1_Exit:
  10.     Exit Function
  11.  
  12. Macro1_Err:
  13.     MsgBox Error$
  14.     Resume Macro1_Exit
  15.  
  16. End Function
  17.  
I also tried creating another table with just email addresses but couldn't get that to work either. please help. What am I doing wrong?

To state the obvious: Iím very new at this!
Dec 28 '07 #1
Share this Question
Share on Google+
5 Replies


Minion
Expert 100+
P: 108
I have searched this form and did google and yahoo but to no avail. I'm trying to send a report via email to email addresses listed in the report but Iím not getting anywhere. This is what I have so far....

Function Macro1()
On Error GoTo Macro1_Err
Dim strSendTo As String
strSendTo = ProjectManagerEMail

DoCmd.SendObject acReport, "month", "SnapshotFormat(*.snp)", strSendTo, "", "", "", "", False, ""


Macro1_Exit:
Exit Function

Macro1_Err:
MsgBox Error$
Resume Macro1_Exit

End Function

I also tried creating another table with just email addresses but couldn't get that to work either. please help. What am I doing wrong?

To state the obvious: Iím very new at this!
I haven't had a chance to test the mailing feature of Access, though I have looked into in recently for a proposed module. Below I will include a couple links I have on mailing from Access that may help you, but first there is something in your code that might be causing you the error.

Try switching the DoCmd line to the following and see if it works out:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.SendObject acSendReport, "month", "SnapshotFormat(*.snp)", strSendTo, , , , , False
  2.  
If this doesn't work I would look furthing into the matter with the following links

Sending Email From Access (Advanced)

Sending Email From Access (Beginner)

Hope some of this helps you.

- Minion -
Dec 28 '07 #2

P: 20
Nope, that didn't work :(
I have looked at those two articles before and am currently palying with the code to make it work for me.
There got to be something in between those two methods discussed by the articles you have pasted the url for. I'm think there got to be a way to add couple lines of code to grab the email address from a query, no?
Dec 28 '07 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
My first question is where is ProjectManagerEmail coming from? Is this a control on a form? Is the form open?

You have written your code in a function. Where is this function written and how and where is it called?
Jan 8 '08 #4

P: 20
My first question is where is ProjectManagerEmail coming from? Is this a control on a form? Is the form open?

You have written your code in a function. Where is this function written and how and where is it called?
I have a table which contains a filed label ProjectManagerEmail. I created a micro and then converted that to a module. I have very limited programing and access knowledge...function is created by access.
Jan 15 '08 #5

P: 20
report which i would like to email also contains ProjectMangerEmail field.
Jan 16 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.