473,385 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Mailing report in lotus notes - can ollyb help? or anyone

After months of work I have finally finished my Change Control management database.

It looks flash all the filters work, all the reports work, importing from Xcel is automatic its lovely........but I am struggling with my final little detail.

I have absolutely no idea where to start. I excel I am able to use the following code:-

Sub Email()


Dim EmailAdd As String
Dim EmailSub As String

Sheets("sheet3").Activate

EmailSub = Sheets("Message").Range("C3").Text

EmailAdd = "mailto:" & Sheets("sheet3").Range("b1").Text & "?subject=" & EmailSub

MsgBox "Address is " & EmailAdd


ActiveWorkbook.FollowHyperlink Address:=EmailAdd, _
NewWindow:=True

End Sub

But putting the following into an access format is proving difficult.

I created a mailing list in a table email_table.
What I want to do is on my form I would select a combo box called system. This lists the different systems we have. For example SAP or POLFS. this table that powers the form is called data_table andthe main form is called data_form.

what I am looking to do is when the field "system" is completed on the data_form, my query will return all the email address' assigned to that product.

This is where I am now confused, how do I get access to use the returned list to populate an email for sending with these email address, and can i get it to automatically attach a specified report i.e daily_summary_report.


Please can someone help me.

thanks.
Tony
Mar 12 '08 #1
3 2357
I have been trying to use some peoples VBA, but I am not sure how to run a Public Sub rather than a Private
Mar 12 '08 #2
well i have tried to have a go at this but feel i may have ovrely complicated it. Also I am not sure how to use a table to populate the email address as this will vary dependant on type of change. anyhow. please help me.
vb()
Expand|Select|Wrap|Line Numbers
  1. Sub SEND_EMAILS()
  2.  
  3. 'open the session with the lotus notes server
  4. 'this sub will output a report as a file
  5. 'attach the file and add the predetermined subject and body
  6. 'delete the file that was output
  7. 'close the session with the server
  8.  
  9. If OPEN_SESSION Then
  10.  
  11. 'output report to text file on C:\
  12. DoCmd.OutputTo acOutputReport, "POL1234", acFormatword, "C:\Documents and Settings\antonio.jamasb\Desktop\OCP Information\POL Report\POL1234", False
  13.  
  14. 'put your do loop here
  15.  
  16. 'reference the email report sub to mail the file
  17. If EMAIL_REPORT("antonio.jamasb@postoffice.co.uk", "My Email Body", "My Subject Line", "C:\Documents and Settings\antonio.jamasb\Desktop\OCP Information\POL Report") = True Then
  18. MsgBox "Message Sent"
  19. Else
  20. 'error in email module
  21. End If
  22.  
  23. 'end your loop here
  24.  
  25. 'delete the file
  26. Kill ("C:\Documents and Settings\antonio.jamasb\Desktop\OCP Information\POL Report\POL1234")
  27.  
  28. 'call the close session sub to destroy the objects
  29. CLOSE_SESSION
  30.  
  31. Else
  32. 'session not opened properly
  33. End If
  34.  
  35. End Sub
  36.  
  37. Function OPEN_SESSION() As Boolean
  38.  
  39. Dim objSession As Object
  40. Dim strServer As String
  41. Dim strMailFile As String
  42.  
  43. 'lotus notes must be open for module to work correctly
  44. If MsgBox("Do you have lotus notes running?", vbCritical + vbYesNo, "Warning!") = vbYes Then
  45. 'this code must be left out of the loop so that only one session is started
  46. Set objSession = CreateObject("Notes.NOTESSESSION")
  47.  
  48. strServer = objSession.GETENVIRONMENTSTRING("mailserver", True)
  49. strMailFile = objSession.GETENVIRONMENTSTRING("mailfile", True)
  50.  
  51. Set mobjDB = objSession.GETDATABASE(strServer, strMailFile)
  52.  
  53. OPEN_SESSION = True
  54. Else
  55. MsgBox "Please start Lotus Notes and try again.", vbOKOnly, "Emails"
  56. OPEN_SESSION = False
  57. End If
  58.  
  59. End Function
  60.  
  61. Function EMAIL_REPORT(strSendTo As String, strBody As String, strSubject As String, Optional strFile As String) As Boolean
  62. On Error GoTo EmailReport_Err
  63.  
  64. Dim objDoc As Object
  65. Dim objRichTextAttach As Object
  66. Dim objRichTextItem As Object
  67. Dim objAttachment As Object
  68.  
  69. Const NOTES_RECIPIENTS = ""
  70. Const NOTES_REPORTS_ADMIN_USER = ""
  71. Const NOTES_MAIL_FILE = "C:\Documents and Settings\antonio.jamasb\Application Data\notes\mail\jamasba.nsf"
  72.  
  73. Set objDoc = mobjDB.CREATEDOCUMENT
  74. Set objRichTextAttach = objDoc.CREATERICHTEXTITEM("File")
  75. Set objRichTextItem = objDoc.CREATERICHTEXTITEM(objDoc, "Body")
  76.  
  77. If strFile <> "" Then
  78. Set objAttachment = objRichTextAttach.EMBEDOBJECT(1454, "", strFile)
  79. End If
  80.  
  81. 'set up the email to be sent
  82. objRichTextItem.AppendText strBody
  83. objDoc.REPLACEITEMVALUE "SendTo", strSendTo
  84. objDoc.REPLACEITEMVALUE "Subject", strSubject
  85.  
  86. objDoc.SaveMessageOnSend = True 'send E-mail
  87. objDoc.SEND False 'false for do not attach a form
  88.  
  89. EMAIL_REPORT = True
  90.  
  91. Exit_Here:
  92. Set objAttachment = Nothing
  93. Set objDoc = Nothing
  94. Set objRichTextAttach = Nothing
  95. Set objRichTextItem = Nothing
  96. Exit Function
  97.  
  98. EmailReport_Err:
  99. EMAIL_REPORT = False
  100. Resume Exit_Here
  101.  
  102. End Function
  103.  
  104. Public Sub CLOSE_SESSION()
  105.  
  106. Set mobjDB = Nothing
  107.  
  108. End Sub
Mar 13 '08 #3
This can be closed I changed the code and sorted it myself.
Mar 13 '08 #4

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

Similar topics

13
by: Sateesh | last post by:
Hi, Is it possible to access Lotus notes using Python? Can anyone provide me some pointers? Thanks Sateesh
5
by: Grzegorz ¦lusarek | last post by:
Hello everyone. I have to get data from Lotus Notes and i curious is it possible doing it with Python. I heard that Lotus Notes using COM, so the Python does so maybe it can be done? Anyone have...
5
by: Colin Anderson | last post by:
I discovered, with great excitement, this article http://www.davison.uk.net/vb2notes.asp when researching methods for emailing from Access via Notes. Unfortunatly, when I run this I get a...
1
by: Grzegorz Smith | last post by:
Hello. I need to call remote lotus' agent in my application, does anyone do something like that? I search google for the solution and i find that I can use COM to connect to Lotus, but probably I...
1
by: Joe | last post by:
HI Has anyone been able to work with lotus notes automation classes??? Can you post sample code of how to use these classes. I have setup in VB but I am not able to port to C# This is what I...
2
by: Rick | last post by:
Hi group!!! I'm new with lotus notes, i'm not sure if, can i send an email through lotus notes? maybe using a lotus dll or a componet? does anyone has an example? Regards Rick
3
by: jambonjamasb | last post by:
Hi I have two tables: email_tbl Data_table Data table is is used to create a Form Data_form
2
by: jambonjamasb | last post by:
Hi I have written code to output a report and add to lotus notes and send. The only problem is that when the report output rich text, so i lose all the details like checkboxes, field boxes, logo...
0
by: Kristoph | last post by:
Hello, I would like to send an Access report as text in the body of a Lotus Notes email. Currently I am using DoCmd.SendObject which sends the report as a text attachment just great! But,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.