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
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
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() - Sub SEND_EMAILS()
-
-
'open the session with the lotus notes server
-
'this sub will output a report as a file
-
'attach the file and add the predetermined subject and body
-
'delete the file that was output
-
'close the session with the server
-
-
If OPEN_SESSION Then
-
-
'output report to text file on C:\
-
DoCmd.OutputTo acOutputReport, "POL1234", acFormatword, "C:\Documents and Settings\antonio.jamasb\Desktop\OCP Information\POL Report\POL1234", False
-
-
'put your do loop here
-
-
'reference the email report sub to mail the file
-
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
-
MsgBox "Message Sent"
-
Else
-
'error in email module
-
End If
-
-
'end your loop here
-
-
'delete the file
-
Kill ("C:\Documents and Settings\antonio.jamasb\Desktop\OCP Information\POL Report\POL1234")
-
-
'call the close session sub to destroy the objects
-
CLOSE_SESSION
-
-
Else
-
'session not opened properly
-
End If
-
-
End Sub
-
-
Function OPEN_SESSION() As Boolean
-
-
Dim objSession As Object
-
Dim strServer As String
-
Dim strMailFile As String
-
-
'lotus notes must be open for module to work correctly
-
If MsgBox("Do you have lotus notes running?", vbCritical + vbYesNo, "Warning!") = vbYes Then
-
'this code must be left out of the loop so that only one session is started
-
Set objSession = CreateObject("Notes.NOTESSESSION")
-
-
strServer = objSession.GETENVIRONMENTSTRING("mailserver", True)
-
strMailFile = objSession.GETENVIRONMENTSTRING("mailfile", True)
-
-
Set mobjDB = objSession.GETDATABASE(strServer, strMailFile)
-
-
OPEN_SESSION = True
-
Else
-
MsgBox "Please start Lotus Notes and try again.", vbOKOnly, "Emails"
-
OPEN_SESSION = False
-
End If
-
-
End Function
-
-
Function EMAIL_REPORT(strSendTo As String, strBody As String, strSubject As String, Optional strFile As String) As Boolean
-
On Error GoTo EmailReport_Err
-
-
Dim objDoc As Object
-
Dim objRichTextAttach As Object
-
Dim objRichTextItem As Object
-
Dim objAttachment As Object
-
-
Const NOTES_RECIPIENTS = ""
-
Const NOTES_REPORTS_ADMIN_USER = ""
-
Const NOTES_MAIL_FILE = "C:\Documents and Settings\antonio.jamasb\Application Data\notes\mail\jamasba.nsf"
-
-
Set objDoc = mobjDB.CREATEDOCUMENT
-
Set objRichTextAttach = objDoc.CREATERICHTEXTITEM("File")
-
Set objRichTextItem = objDoc.CREATERICHTEXTITEM(objDoc, "Body")
-
-
If strFile <> "" Then
-
Set objAttachment = objRichTextAttach.EMBEDOBJECT(1454, "", strFile)
-
End If
-
-
'set up the email to be sent
-
objRichTextItem.AppendText strBody
-
objDoc.REPLACEITEMVALUE "SendTo", strSendTo
-
objDoc.REPLACEITEMVALUE "Subject", strSubject
-
-
objDoc.SaveMessageOnSend = True 'send E-mail
-
objDoc.SEND False 'false for do not attach a form
-
-
EMAIL_REPORT = True
-
-
Exit_Here:
-
Set objAttachment = Nothing
-
Set objDoc = Nothing
-
Set objRichTextAttach = Nothing
-
Set objRichTextItem = Nothing
-
Exit Function
-
-
EmailReport_Err:
-
EMAIL_REPORT = False
-
Resume Exit_Here
-
-
End Function
-
-
Public Sub CLOSE_SESSION()
-
-
Set mobjDB = Nothing
-
-
End Sub
This can be closed I changed the code and sorted it myself.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Sateesh |
last post by:
Hi,
Is it possible to access Lotus notes using Python? Can anyone provide me
some pointers?
Thanks
Sateesh
|
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...
|
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...
|
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...
|
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...
|
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
|
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
|
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...
|
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,...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
| |