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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time error '7294'

Status
Not open for further replies.

DrSmyth

Technical User
Jul 16, 2003
557
GB
I'm running some code behind business objects, basically it runs through a report, filters it and then uses Lotus Notes to e-mail to a relevant person.

However i'm getting the following error message, which i can't find a reason for - has anybody come accross it before?

Run-time error '7294' unable to send mail, no match found in name and address book

Can anybody help??
 
Sorted this, the variable wasn't holding the correct value....
 
Hey Doc,

Help me out here!

I can't see your list, your variable, your code.

AND...

you never answered my question

AND...

you respond with a cryptic statement,

"Sorted this, the variable wasn't holding the correct value...."

My inductive skills are at end-of-wit!

Skip,
Skip@TheOfficeExperts.com
 
Ok, basically i've had to re-jig all of the code and I've come up with this... The problem basically was that the e-mail address was being looked up from the entire list of e-mail addresses in an alphabetical order and not the corresponding e-mail address that tied in with the main variable i was using to produce the report, and what i now have is this:
Sub FilterAndExportMail()

Dim myDoc As Document
Dim myrpt As Report
Dim myFilterVar As DocumentVariable
Dim i, intNumChoices As Integer
Dim myFilterChoices As Variant
Dim strNextValue As String
Dim StrNextValue1 As String
Dim Maildb As Object
Dim username As String
Dim maildbname As String
Dim maildoc As Object
Dim attachme As Object
Dim session As Object
Dim embedobject As Object
Dim mytime As String
Dim recipient As String
Dim subject As String
Dim attachment As String
Dim BodyText As String
Dim doc As Document
Dim docs As Documents
Dim dps As DataProviders
Dim dp As DataProvider
Dim cols As Columns
Dim col As Column

' Active (open) Document
Set myDoc = ActiveDocument

' Active (with focus) Report
Set myrpt = ActiveReport

' Put your variable (or query object) here
Set myFilterVar = myDoc.DocumentVariables("Manager")

' find out how many resort values there are
intNumChoices = UBound(myFilterVar.Values(boUniqueValues))

' collect the number of choices in a variant variable
myFilterChoices = myFilterVar.Values(boUniqueValues)

For i = 1 To intNumChoices

' Get the variable value
strNextValue = myFilterChoices(i)


' build filter
myrpt.AddComplexFilter myFilterVar, &quot;=<Manager> = &quot; & &quot;&quot;&quot;&quot; & strNextValue & &quot;&quot;&quot;&quot;

' recompute the report
myrpt.ForceCompute
strNextValue = myFilterChoices(i)

' now export to desired format, using the filter value as part of the name
myrpt.ExportAsHtml (&quot;F:\MI\Wills Mi\Pfs\Wills Not Signed &quot; & strNextValue & &quot;.html&quot;)



Set dps = myDoc.DataProviders
Set dp = dps.Item(1) 'if you have more than 1 dataprovider enter the number of the data provider where the filter data is held
Set cols = dp.Columns
Set col = cols.Item(1) 'in this example the customer field is the first column in the dataprovider, you will need to enter the number of the column that you need to reference

For j = 1 To col.Count 'for each value in the column...

If strNextValue = col.Item(j) Then 'set the filter variable to the current customer's name
Set col = cols.Item(2)
StrNextValue1 = col.Item(j)
End If
Set col = cols.Item(1)
Next j 'loop
'this next bit performs the e-mailing
recipient = StrNextValue1
subject = &quot;Wills Not Signed Report&quot;
attachment = &quot;F:\MI\Wills Mi\Pfs\Wills Not Signed &quot; & strNextValue & &quot;.rtf&quot;
BodyText = &quot;Wills Not Signed&quot;
Set session = CreateObject(&quot;Notes.NotesSession&quot;)
username = session.username

Set Maildb = session.GETDATABASE(&quot;&quot;, maildbname)

If Maildb.ISOPEN = True Then

Else
Maildb.OPENMAIL
End If

Set maildoc = Maildb.CREATEDOCUMENT
maildoc.Form = &quot;Memo&quot;
maildoc.sendto = recipient
maildoc.subject = subject
maildoc.Body = BodyText


If attachment <> &quot;&quot; Then
Set attachme = maildoc.CREATERICHTEXTITEM(&quot;Attachment&quot;)
Set embedobject = attachme.embedobject(1454, &quot;&quot;, attachment, &quot;Attachment&quot;)
End If

maildoc.PostedDate = Now()
maildoc.Send 0, recipient

Set Maildb = Nothing
Set maildoc = Nothing
Set attachme = Nothing
Set session = Nothing
Next i

myrpt.AddComplexFilter myFilterVar, &quot;=(1=1)&quot;
myrpt.ForceCompute

End Sub

Which works
 
So, Doc,

You stated in your last posting,

&quot;The problem basically was ...&quot; (emphasis added)

and your last words were,

&quot;Which works&quot;! (emphases {including color} added)

which, I conclude, means that you have solved your own problem.

You aren't a dentist, by any chance, are you? (I mean the teeth pulling kind)

Skip,
Skip@TheOfficeExperts.com
 
Unfortunately i'm not a dentist, just an underpaid office worker who is expected to come up with some complicated IT solutions on a pittance of a wage!!!!!

Yes, in the end i did sort the problem myself, the original post was the first hurdle i came accross..... Thanks for the help anyway
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top