Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

E-mail problems with Lotus Notes 1

Status
Not open for further replies.

stupiet

Programmer
Aug 21, 2001
176
US
To anyone who can help or he has the same issue,

At work we use lotus notes. I created an access database that will send data from the database to anyone while your lotus notes is running.

I got the code to send out e-mails using notes from another thread and everything works fine. The only problem I have is when it gets into my mailbox the following message pops up:

"A stored form can not contain computed subforms"

It will pop up a couple of times before I can read the e-mail. Is there anything I'm doing wrong or is this a bug in Lotus Notes? Is there a way for me to eliminate this?

I appreciate your help. Below is the code I used to compile the info to be send out and below that I have posted the code for the module that uses notes to send it.

===========================================================

For Each var In ListSend.ItemsSelected
strList = ListSend.ItemData(var)
recip(intnum) = strList
intnum = intnum + 1
Next var

Dim stBody As String
stBody = stBody & "File Number:" & vbCr
stBody = stBody & "==========================" & vbCr
stBody = stBody & Forms!SOInfo.SONUM & vbCr & vbCr
stBody = stBody & "Type:" & vbCr
stBody = stBody & "==========================" & vbCr
stBody = stBody & Forms!SOInfo.LSOTYPE & vbCr & vbCr

If Forms!SOInfo.DEPT <> "" Then
stBody = stBody & "Department:" & vbCr
stBody = stBody & "==========================" & vbCr
stBody = stBody & Forms!SOInfo.DEPT & vbCr & vbCr
End If

SendNotesMail "Safety Observation #" & Forms!SOInfo.SONUM, "", recip, "", stBody, True


===========================================================

Sub SendNotesMail(Subject As String, Attachment As String, Recipient As Variant, cc As String, BodyText As String, SaveIt As Boolean)

'Set up the objects required for Automation into lotus notes
Dim MailDb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself NotesDocument
Dim MailDoc2 As Object
Dim AttachME As Object 'The attachment richtextfile object
Dim session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim CurrentDatabase As String
Dim NotesSS As Object
Dim NotesDb As Object

On Error GoTo Errshow:

Set NotesSS = CreateObject("Notes.NotesSession")
With NotesSS
Set NotesDb = .GETDATABASE("WAKEAM3/WYP", "mail\721116.nsf")
End With

With NotesDb
'Start a session to notes
Set session = CreateObject("Notes.NotesSession")
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string
UserName = session.UserName
MailDbName = NotesDb.FileName

Set MailDb = session.GETDATABASE("", MailDbName)

If Not (MailDb.ISOPEN) = True Then MailDb.OPENMAIL

'Set up the new mail document
Set MailDoc = MailDb.CREATEDOCUMENT
With MailDoc
.Form = "Memo"
.sendto = Recipient
.CopyTo = cc
.Subject = Subject
.body = BodyText
.SAVEMESSAGEONSEND = SaveIt
End With
'Set up the embedded object and attachment and attach it
If Attachment <> "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment")
MailDoc.CREATERICHTEXTITEM ("Attachment")
End If

End With

'Send the document
MailDoc.send 1, Recipient
MsgBox "A copy of the Observation has been sent.", vbOKOnly, "Observation Sent"
Cleanup:

Set MailDb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set session = Nothing
Set EmbedObj = Nothing

Exit Sub

Errshow:
If Err.Number = 7063 Then
MsgBox "You have not logged onto Lotus Notes. Please log on and try to send again."
Else
MsgBox (Err.Description)
End If
GoTo Cleanup

End Sub
 
I emailed one of the resident Notes experts to check out this thread, I don't think he normally lurks in the Access forums, and this is technically a Notes question since you're not getting the error message until you try to open the email.

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
Appreciate your help in forwarding this on.
 
Hello stupiet,

I'm the nerd that Leslie alerted about your issue. She seems to think I'm worth something in Notes ;-).

Whether or not that is true, I am intrigued about one or two things in your code. I would need a bit more info about one point in particular :

When you write stBody = stBody & Forms!SOInfo.SONUM & vbCr & vbCr, could you indicate which object Forms and SOInfo represent ? It might be easier if you included the Declaration section.

Independant of this point, if you are dealing with subforms and special forms not included in the Notes mail, it might be a better idea to create a database dedicated to the form of data you wish to display.

That way, you could write the relevant information in a Notes form, with all the subform complexity you need, and simply send a link to the users.

In any case, I'll be looking at your code in detail.

Cheers !

Pascal.


I've got nothing to hide, and I'd very much like to keep that away from prying eyes.
 


Hi Pascal,

I haven't had the chance yet to respond to your thread. I hope you can still help me.

I don't quite understand what you meant with your question but I'll try to explain it.

Forms!SOInfo refers to a form created in access. In order to call a value in a textbox of that form I have to write the path. Therefore if I want to display in my e-mail the field "SONUM" on the form called "SOInfo" in VB I would write:

Forms!SOInfo.SONUM

That way the e-mail will automatically include the SONUM field.

I hope this will help you out a little bit more. Let me know what else you may need.

I really appreciate your help..


 
And that is where the problem lies. Your Form in VB does not exist in Notes, so you get an error message and, probably, a display issue as well.

Going back to my first suggestion, it would probably be a good idea to store all this info in a new Notes db that users can be linked to via the mail. There, you can recreate the form and field in Notes and have everything display correctly.

You can also extract the field value and just place that (in text value) in the mail to have it transmitted as part of the body of the mail. That will remove the error and the need to create a new db to display information.

Pascal.


I've got nothing to hide, and I'd very much like to keep that away from prying eyes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top