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

Each Record in Access report Should go as mail to the email specified in report

P: 62
I have a report which contains Employee Code,Name and E-Mail Address.
I want auto generating button next to each row.
Which will email record only in that row to the email id specified in that row.
Oct 28 '13 #1

✓ answered by topher23

Whoops! I noted that problem previously and thought I'd already fixed it on the blog post. The function calls another function that it uses to iterate adding attachments based on the number of semicolons in the string. Here's the other function that you'll need to paste into the module with the SendSMTP function:
Expand|Select|Wrap|Line Numbers
  1. Public Function CountInStr(StringToCheck As String, StringToFind As String) As Long
  2.     CountInStr = (Len(StringToCheck) - Len(Replace(StringToCheck, StringToFind, ""))) / Len(StringToFind)
  3. End Function
  4.  

Share this Question
Share on Google+
5 Replies


topher23
Expert 100+
P: 234
Okay, here's what you do.
1. Put a command button in the detail section of your report. You probably want to set the "Display When" property to "Screen Only," so it doesn't show up if you print your report.
2. If you use Outlook in your company, you can use Outlook Automation methodology to send your email. If you don't want to rely on Outlook, check out my post about using SMTP via GMail.
3. If you decide to import my SendSMTP function, the only code you need in your command button will look like this:
Expand|Select|Wrap|Line Numbers
  1. SendSMTP Me.[EmployeeEmail], "[Your Subject line]", "Some body text " & Me.[Field1] & "; " & me.[Field2] 
If you go with Outlook automation, you'll apply the same concept with the Outlook syntax instead.
Oct 28 '13 #2

P: 62
thanks for reply topher23 i tried ur function but Its throwing error "sub or function not defined"
Oct 29 '13 #3

topher23
Expert 100+
P: 234
Whoops! I noted that problem previously and thought I'd already fixed it on the blog post. The function calls another function that it uses to iterate adding attachments based on the number of semicolons in the string. Here's the other function that you'll need to paste into the module with the SendSMTP function:
Expand|Select|Wrap|Line Numbers
  1. Public Function CountInStr(StringToCheck As String, StringToFind As String) As Long
  2.     CountInStr = (Len(StringToCheck) - Len(Replace(StringToCheck, StringToFind, ""))) / Len(StringToFind)
  3. End Function
  4.  
Oct 29 '13 #4

P: 62
thanks topher23 it works like champ
Oct 29 '13 #5

topher23
Expert 100+
P: 234
always happy to help!
Oct 29 '13 #6

Post your reply

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