Hey guys (and gals),
I'm using some code to send emails with the cdosys.dll, and it works fine in one db that I have. The code uses late binding in case the user doesn't have the cdo reference enabled (and checks to see if cdoex.dll is used instead). Here's the code I'm using:
In one of my databases, I get the error "Fullpath Method of Object Reference Failed" when this code is triggered. The only difference that I can see between my two databases is that the one producing the error has fm20.dll as a reference. The db won't let me remove this reference, and when I physically remove it from it's file path, the combo box controls in this database cease to function. I can't even remove this reference when it says "MISSING". I'm developing in Access 2003/compatible to 2000. Any ideas?
I'm using some code to send emails with the cdosys.dll, and it works fine in one db that I have. The code uses late binding in case the user doesn't have the cdo reference enabled (and checks to see if cdoex.dll is used instead). Here's the code I'm using:
Code:
Private Sub V_C125_AfterUpdate()
On Error GoTo Err_V_C125_AfterUpdate_Click
'Dim stDocName As String
Dim stSendTo As String
Dim strUser As String
Dim stSendCC As String
Dim stSubject As String
Dim stMsg As String
Dim ref As Reference
Dim isref As Boolean
Dim strRemind As String
isref = False
'stDocName = "rptAuditFindings"
stSendTo = "mg100291"
strUser = fWinXPUserName
stSendCC = strUser
stSubject = "V-C125 level at " & Me.V_C125 & "%"
stMsg = "Please contact Seimens Water Technology to drain V-C125."
strRemind = "A reminder to empty V-C125 has been sent" & vbCrLf & _
"to the ESL and copied to your email inbox."
'Enumerate through References collection.
For Each ref In References
If ref.FullPath = "C:\WINDOWS\System32\cdosys.dll" Then
isref = True
Exit For
ElseIf ref.FullPath = "C:\Program Files\Common Files\Microsoft Shared\CDO\cdoex.dll" Then
isref = True
Exit For
Else
'do nothing
End If
Next ref
If isref = False Then
References.AddFromFile "C:\WINDOWS\System32\cdosys.dll"
End If
'Refresh form, just in case it needs it.
Me.Refresh
If Me.V_C125 > 79 Then
Call SendVC125EMailViaCDO(stMsg, stSendTo, strUser, stSendCC, stSubject, True)
MsgBox strRemind, vbInformation + vbOKOnly
Else
'do nothing
End If
Exit_V_C125_AfterUpdate_Click:
Exit Sub
Err_V_C125_AfterUpdate_Click:
MsgBox Err.Description
Resume Exit_V_C125_AfterUpdate_Click
End Sub