teriwinkle
Technical User
Hello,
I have a cmdButton to email a report. HOwever, I have the database secured with the users who would need to email the reports as "new data" and "update data" users. Apparently only users with full permissions can currently send the email becasue of the CreateObject command. The error occurs at this point in the code below:
Set notessession = CreateObject("Notes.Notessession")
Here is the code for my lotus notes email button:
______________________________________________
Private Sub cmdEmail_Click()
Set MyDatabase = CurrentDb()
Dim mFormName As String
Dim MyQueryDef As DAO.QueryDef
Dim notesdb As Object
Dim notesdoc As Object
Dim notesrtf As Object
Dim notessession As Object
Dim NVRJob As Object
Dim strChemist As Object
Dim strPass As Object
Dim strToWhom As Object
Dim strSubject As String
mFormName = "frm_NVR_sub"
strSubject = "Job" & " " & Me!JobNo & " " & "NvrReport"
Set NVRJob = Me![JobNo]
Set strChemist = Me![Chemist]
Set notessession = CreateObject("Notes.Notessession")
Set notesdb = notessession.GetDatabase("", "")
Call notesdb.OPENMAIL
Rem make new mail message
Set notesdoc = notesdb.CreateDocument
Call notesdoc.REPLACEITEMVALUE("Sendto", "tlR@myemail.com")
'Call notesdoc.REPLACEITEMVALUECall notesdoc.REPLACEITEMVALUE("Subject", strSubject)
Set notesrtf = notesdoc.CreateRichTextItem("body")
Call notesrtf.AppendText("The NVR testing is complete for Job # ")
Call notesrtf.AppendText("The NVR testing is complete for", NVRJob)
Call notesrtf.AddNewLine(2)
Call notesrtf.AppendText(strChemist)
Call notesrtf.AddNewLine(2)
Call notesrtf.EmbedObject(1454, "", "C\PCL_CUSTOMERS\pcldata\rptNvr\NVRReport.rtf")
notesdoc.SAVEMESSAGEONSEND = True '(this code works for saving a message in the Sent folder)
notesdoc.Visible = True
Call notesdoc.Save(True, False)
Rem attach Error Report doc
's = ActiveDocument.Path + "\" + ActiveDocument.Name
' Call notesrtf.EmbedObject(1454, "", strCurrentPath, "Mail.rtf")
Rem send message
Call notesdoc.Send(False)
Set notessession = Nothing
End Sub
_____________________________________________-
Is there away around this without giving the users full permissions?
Thanks!
I have a cmdButton to email a report. HOwever, I have the database secured with the users who would need to email the reports as "new data" and "update data" users. Apparently only users with full permissions can currently send the email becasue of the CreateObject command. The error occurs at this point in the code below:
Set notessession = CreateObject("Notes.Notessession")
Here is the code for my lotus notes email button:
______________________________________________
Private Sub cmdEmail_Click()
Set MyDatabase = CurrentDb()
Dim mFormName As String
Dim MyQueryDef As DAO.QueryDef
Dim notesdb As Object
Dim notesdoc As Object
Dim notesrtf As Object
Dim notessession As Object
Dim NVRJob As Object
Dim strChemist As Object
Dim strPass As Object
Dim strToWhom As Object
Dim strSubject As String
mFormName = "frm_NVR_sub"
strSubject = "Job" & " " & Me!JobNo & " " & "NvrReport"
Set NVRJob = Me![JobNo]
Set strChemist = Me![Chemist]
Set notessession = CreateObject("Notes.Notessession")
Set notesdb = notessession.GetDatabase("", "")
Call notesdb.OPENMAIL
Rem make new mail message
Set notesdoc = notesdb.CreateDocument
Call notesdoc.REPLACEITEMVALUE("Sendto", "tlR@myemail.com")
'Call notesdoc.REPLACEITEMVALUECall notesdoc.REPLACEITEMVALUE("Subject", strSubject)
Set notesrtf = notesdoc.CreateRichTextItem("body")
Call notesrtf.AppendText("The NVR testing is complete for Job # ")
Call notesrtf.AppendText("The NVR testing is complete for", NVRJob)
Call notesrtf.AddNewLine(2)
Call notesrtf.AppendText(strChemist)
Call notesrtf.AddNewLine(2)
Call notesrtf.EmbedObject(1454, "", "C\PCL_CUSTOMERS\pcldata\rptNvr\NVRReport.rtf")
notesdoc.SAVEMESSAGEONSEND = True '(this code works for saving a message in the Sent folder)
notesdoc.Visible = True
Call notesdoc.Save(True, False)
Rem attach Error Report doc
's = ActiveDocument.Path + "\" + ActiveDocument.Name
' Call notesrtf.EmbedObject(1454, "", strCurrentPath, "Mail.rtf")
Rem send message
Call notesdoc.Send(False)
Set notessession = Nothing
End Sub
_____________________________________________-
Is there away around this without giving the users full permissions?
Thanks!