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

Outlook email error on one PC

Status
Not open for further replies.

jadams0173

Technical User
Feb 18, 2005
1,210
I have a function that sends a report as an attachment. However, I keep getting error -2079129597 Internal application error on the red line below. This code use to work on this machine and works fine on about 10 others.

The only thing I've found so far was Microsoft Outlook object 9.0 library had MISSING beside it. I unchecked the box, closed the mdb then opened and rechecked the box and all seemed well. I've made sure that MSOUTL9.OLB exisits and it's the same version as working machines.

One other thing was the outlook exchange server was wrong so I changed that to what it should be. Outlook itself works fine. I can send an receive emails. Here is the part of the function that fails.

Code:
Dim otk As Outlook.Application
Dim eml As Outlook.MailItem
Dim strList As String
Dim rs      As ADODB.Recordset

On Error GoTo ERRHANDLER:
'On Error Resume Next

    ' Open your table and build your distribution list
    Set rs = New ADODB.Recordset
    With rs
        .Open "tblEmail", CurrentProject.Connection, adOpenStatic, adLockReadOnly, adCmdTable
    End With
    
    Do While Not rs.EOF
        strList = strList & Trim(rs.Fields("EmailAddress").Value) & ";"
        rs.MoveNext
    Loop
    rs.Close
    Set rs = Nothing

    Set otk = CreateObject("Outlook.Application")
   [red] Set eml = otk.CreateItem(olMailItem)[/red]
    
    With eml
.
.
.

Any ideas? Thanks is advance!


I tried to have patience but it took to long! :) -DW
 
Try changing:
Code:
Set eml = otk.CreateItem(olMailItem)
...to:
Code:
Set eml = otk.CreateItem(0)

If the error disappears, you still have a reference problem. If not, then there's something else going on with that machine.
 
Thanks for the reply ByteMyzer. I made the change you suggested but still have the error. Although I wrote down the wrong error number or it changed to error # -2113732605

I tried to have patience but it took to long! :) -DW
 
I searched on the new error number and found this thread705-1080686 that talks about NameSpace.

For whatever reason, when I added the lines in [blue]blue[/blue] it worked! Any ideas as to why on this one machine it took this to make it work?

Code:
[blue][b]dim otkNS  as Outlook.NameSpace[/b][/blue]
Dim otk As Outlook.Application
Dim eml As Outlook.MailItem
Dim strList As String
Dim rs      As ADODB.Recordset

On Error GoTo ERRHANDLER:
'On Error Resume Next

    ' Open your table and build your distribution list
    Set rs = New ADODB.Recordset
    With rs
        .Open "tblEmail", CurrentProject.Connection, adOpenStatic, adLockReadOnly, adCmdTable
    End With
    
    Do While Not rs.EOF
        strList = strList & Trim(rs.Fields("EmailAddress").Value) & ";"
        rs.MoveNext
    Loop
    rs.Close
    Set rs = Nothing

    Set otk = CreateObject("Outlook.Application")
    [blue][b]Set otkNS=otk.GetNamespace("MAPI")
    otkNS.Logon[/b][/blue]


    Set eml = otk.CreateItem(olMailItem)
    
    With eml
.
.
.



I tried to have patience but it took to long! :) -DW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top