Email button error

N

Neil Greenough

I have the following code:-

Private Sub cmdSendHomeEmail_Click()
Dim notesdb As Object
Dim notesdoc As Object
Dim notesrtf As Object
Dim notessession As Object
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", Me.Email)
Set notesrtf = notesdoc.createrichtextitem("body")
Rem attach Error Report doc
's = ActiveDocument.Path + "\" + ActiveDocument.Name
Call notesrtf.embedObject(1454, "", Me.Email, "Mail.rtf")
Rem send message
Call notesdoc.Send(False)
Set notessession = Nothing

End Sub

I had this on one form in a database and it worked, so I have copied it to a
from in another database and I am now getting an error:-

"Compile error: Method or data member not found"

Now, my email field is called "Email" and so i don't see what the problem
is? I want to basically send an email via lotus notes by clicking this
button to the email address in the 'Email' field on that specific record on
the form

Any ideas as this is quite urgent?

Thanks
 
M

M.L. Sco Scofield

First, it would save time if you indicated which line the compile error
happened on.

I assume it is:
Call notesdoc.replaceitemvalue("Sendto", Me.Email)

Are your sure the form in your new database is bound to a table or query
that has a field named "Email"?

I could only duplicate your error when my form didn't have an "Email" field.
Otherwise, it compiles just fine.

Sco

M.L. "Sco" Scofield, Microsoft Access MVP, MCSD, MCP, MSS, A+
Denver Area Access Users Group Vice President www.DAAUG.org
MS Colorado Events Administrator www.MSColoradoEvents.com
Useful Metric Conversion #18 of 19: 8 nickels = 2 paradigms (My personal
favorite)
Miscellaneous Access and VB "stuff" at www.ScoBiz.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top