Group:  Microsoft Access ยป microsoft.public.access.modulescoding
Thread: Unable to generate email with upgrade

Unable to generate email with upgrade
TaylorGaffney <taylor.gaffney[ at ]gmail.com> 11/19/2008 3:47:26 PM

I have upgraded my laptop from XP SP2 to Vista SP1.
Since I have upgraded, I am unable to send these simple reports in an
access program I have created. I was able to do this for well over a
year before upgrading to Vista.
If you need more info, or questions please ask. I need to resolve
this quickly.

CODE 1:

Dim db As Database
Dim rs As Recordset, rs2 As Recordset, strClause As String, rptName
As
String, i As Integer
Dim Email As String, fn As String, rtn
Set db = CurrentDb
Set rs = db.OpenRecordset("tbl CSRs")
Set rs2 = db.OpenRecordset("qsl ComlogSelected")
Do Until rs.EOF
strClause = "CSR = " & "'" & rs![CSRCode] & "'"
rs2.FindFirst strClause
If Not rs2.NoMatch Then
rptName = "comlog" & rs![CSRCode]
DoCmd.OpenReport "rpt Comlog", acViewDesign
Reports![rpt Comlog].Caption = rptName
DoCmd.Close acReport, "rpt Comlog", acSaveYes
DoCmd.OpenReport "rpt Comlog", acViewNormal, , strClause
For i = 1 To 5000
DoEvents
Next i
fn = "c:\access02\" & rptName & ".pdf"
Email = rs![EmailAddress]
rtn = SendEmail(Email, fn)
End If
rs.MoveNext
Loop
rs.Close
rs2.Close
End Function

Then I run

CODE 2:


Public Function PTOeMail(sTo As String, sSubject As String, sMsg As
String, Optional sCC As String, Optional sAttachment As String)
Dim olApp As Object
Dim myItem
On Error GoTo Email_GooFed
Set olApp = CreateObject("outlook.application")
Set myItem = olApp.Application.CreateItem(0)
myItem.To = sTo
myItem.Subject = sSubject
myItem.Body = sMsg
myItem.CC = sCC
myItem.Attachments.Add sAttachment
myItem.Send
EMail_ExIT:
Exit Function
Email_GooFed:
MsgBox "Your system was unable to generate the email message. " _
& "You will have to notify them differently if necessary.",
vbInformation
Resume EMail_ExIT
End Function

I get this message on every attempt.
"Your system was unable to generate the email message. " _
& "You will have to notify them differently if necessary."

Is there anything special that needs to be done using VISTA with
ACCESS 02 and OUTLOOK 2007?
I have used OUTLOOK 2007 with ACCESS 02 and it has been fine, since
the upgrade I have no luck.

RE: Unable to generate email with upgrade
Clifford Bass 11/20/2008 5:43:00 AM
Hi Taylor,

Please see my question in the other newsgroup where you posted. It is
best to limit yourself to one group so that different people do not waste
time answering the same question and so that all conversations about the
topic are in the same group.

Clifford Bass

"TaylorGaffney" wrote:

[Quoted Text]
>
> I have upgraded my laptop from XP SP2 to Vista SP1.
> Since I have upgraded, I am unable to send these simple reports in an
> access program I have created. I was able to do this for well over a
> year before upgrading to Vista.
> If you need more info, or questions please ask. I need to resolve
> this quickly.
>
> CODE 1:
>
> Dim db As Database
> Dim rs As Recordset, rs2 As Recordset, strClause As String, rptName
> As
> String, i As Integer
> Dim Email As String, fn As String, rtn
> Set db = CurrentDb
> Set rs = db.OpenRecordset("tbl CSRs")
> Set rs2 = db.OpenRecordset("qsl ComlogSelected")
> Do Until rs.EOF
> strClause = "CSR = " & "'" & rs![CSRCode] & "'"
> rs2.FindFirst strClause
> If Not rs2.NoMatch Then
> rptName = "comlog" & rs![CSRCode]
> DoCmd.OpenReport "rpt Comlog", acViewDesign
> Reports![rpt Comlog].Caption = rptName
> DoCmd.Close acReport, "rpt Comlog", acSaveYes
> DoCmd.OpenReport "rpt Comlog", acViewNormal, , strClause
> For i = 1 To 5000
> DoEvents
> Next i
> fn = "c:\access02\" & rptName & ".pdf"
> Email = rs![EmailAddress]
> rtn = SendEmail(Email, fn)
> End If
> rs.MoveNext
> Loop
> rs.Close
> rs2.Close
> End Function
>
> Then I run
>
> CODE 2:
>
>
> Public Function PTOeMail(sTo As String, sSubject As String, sMsg As
> String, Optional sCC As String, Optional sAttachment As String)
> Dim olApp As Object
> Dim myItem
> On Error GoTo Email_GooFed
> Set olApp = CreateObject("outlook.application")
> Set myItem = olApp.Application.CreateItem(0)
> myItem.To = sTo
> myItem.Subject = sSubject
> myItem.Body = sMsg
> myItem.CC = sCC
> myItem.Attachments.Add sAttachment
> myItem.Send
> EMail_ExIT:
> Exit Function
> Email_GooFed:
> MsgBox "Your system was unable to generate the email message. " _
> & "You will have to notify them differently if necessary.",
> vbInformation
> Resume EMail_ExIT
> End Function
>
> I get this message on every attempt.
> "Your system was unable to generate the email message. " _
> & "You will have to notify them differently if necessary."
>
> Is there anything special that needs to be done using VISTA with
> ACCESS 02 and OUTLOOK 2007?
> I have used OUTLOOK 2007 with ACCESS 02 and it has been fine, since
> the upgrade I have no luck.
>
>

Home | Search | Terms | Imprint
Newsgroups Reader