Active X Error when emailing from Access (1 Viewer)

turniporange23

New member
Local time
Tomorrow, 03:49
Joined
Sep 1, 2024
Messages
4
I have moved my Database from a 32 bit operating system to a 64 bit computer. I am Running Microsoft Access Runtime 2013 and it operates my database just fine on my laptop, Except when my database goes to send a email, It creates the pdf files then I get this error [ Active X component cant create object ] Emailing form my 32 bit system is not a problem

Thanks for any help , Bob

This is part of my email code to Outlook:

Dim myitem As Object
Dim myout As Object
Set myout = CreateObject("Outlook.Application")
Set myitem = myout.CreateItem(0)
With myitem
.To = strMail
.Cc = Nz(DLookup("EmailCC", "tblOwnerInfo", "OwnerID = " & lngID), "")
.Bcc = Nz(DLookup("EmailBCC", "tblOwnerInfo", "OwnerID = " & lngID), "")
.Subject = "Your Statement/Invoice" & " from " & Nz(DLookup("[CompanyName]", "tblCompanyInfo"))
.Body = strBodyMsg
.Attachments.Add myfile1
If ckbTerms = True Then
.Attachments.Add myfile3
End If
If mytot > 0 And ckbStateOnly = False Then
.Attachments.Add myfile2
End If

.Send

End With
Set myitem = Nothing
Set myout = Nothing
cbOwnerName.SetFocus

Case Else
Exit Sub

End Select
ExitProc:
 
Things that help:
1) indicate what line causes the error.
2) use code tags. Code is hard to understand, especially other people's code. Preserving your indents and structure helps a lot.
3) post all the code.
hth
 
You might wish to search this forum for suggestions regarding preparation for converting a 32-bit app to a 64-bit app. Most of the time, it doesn't matter - but not all 32-bit libraries were converted to 64-bit versions when the first 64-bit versions of Office became available. I don't know how many libraries were not converted. It might pay to open your VBA screen and check Tools >> References to see if any of the checked references are missing or broken.
 
Hi. Welcome to AWF!

Just curious, is the 64-bit computer using the New Outlook?
 
Interesting point. I have both Outlook versions on my laptop and code works. New version is set as default mail app.
I also have Access 2021 installed. I've never used Runtime.

Maybe upgrade to Runtime 2021 and see if that helps.
 
Last edited:
Op is saying they have moved a 32bit app from a 32bit windows to 64bit windows,

They have not said they have also moved from 32bit access to 64bit access -or whether they are using 32bit office (at least for outlook ) but would be good to clarify
 
My Laptop is running 64 bit Microsoft 365 Office , My database was created in Access 2013 in 32 bit operating System
I have opened my Database with Microsoft Office Access 64 bit and everything works fine , except when i go to email
I have 2 options of emailing in my database Outlook and Windows Live , Both emails are working fine on the laptop
I have tried both options to email and get the same error {Active X component cant create object ) I have bebuged my database and have no errors..........Thanks for any help..........Bob

This is my complete code for emailing via Outlook
Private Sub SendMailButton_Click()
If IsNull(tbEmailOption.value) = True Or tbEmailOption.value = vbNullString Then
MsgBox "Please make a Email Format Selection!" & vbCrLf & "Close and Re-Open Statements", vbApplicationModal + vbInformation + vbOKOnly
Exit Sub
End If
On Error GoTo Err_Command35_Click
If Me.Dirty = True Then
Me.Dirty = False
Dim myfile1 As String, myfile2 As String, myfile3 As String

End If
Dim mydir As String
mydir = Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name)))
Dim lngID As Long, strMail As String, strBodyMsg As String, _
blEditMail As Boolean, sndReport As String, strCompany As String
Dim msgPmt As String, msgBtns As Integer, msgTitle As String, msgResp As Integer, tbAmount As String
Dim strFormat As String
Dim mytot As Long
mytot = DCount("[InvoiceID]", "qrySelInvoices", "")

Select Case Me.tbEmailOption.value

Case "ADOBE"
strFormat = acFormatPDF
myfile1 = mydir & "Statement.pdf"
myfile2 = mydir & "Invoices.pdf"
myfile3 = mydir & "Terms_and_Conditions.pdf"
Case "WORD"
strFormat = acFormatRTF
myfile1 = mydir & "Statement.rtf"
myfile2 = mydir & "Invoices.rtf"
myfile3 = mydir & "Terms_and_Conditions.rtf"

Case "SNAPSHOT"
strFormat = acFormatSNP
myfile1 = mydir & "Statement.SNP"
myfile2 = mydir & "Invoices.SNP"
myfile3 = mydir & "Terms_and_Conditions.SNP"

Case "TEXT"
strFormat = acFormatTXT
myfile1 = mydir & "Statement.txt"
myfile2 = mydir & "Invoices.txt"
myfile3 = mydir & "Terms_and_Conditions.txt"

Case "HTML"
strFormat = acFormatHTML
myfile1 = mydir & "Statement.htm"
myfile2 = mydir & "Invoices.htm"
myfile3 = mydir & "Terms_and_Conditions.htm"

Case Else ' catch all others
strFormat = acFormatRTF
myfile1 = mydir & "Statement.htm"
myfile2 = mydir & "Invoices.htm"
myfile3 = mydir & "Terms_and_Conditions.htm"

End Select

Select Case Me.OpenArgs

Case "OwnerStatement"

sndReport = "Client_Statement"


lngID = Nz(Me.cbOwnerName.Column(0), 0)
strMail = OwnerEmailAddress(lngID)
tbAmount = Nz(Me.cbOwnerName.Column(5), 0)

strBodyMsg = "To: "
strBodyMsg = strBodyMsg & Nz(DLookup("[ClientTitle]", "tblOwnerInfo", "[OwnerID]=" & lngID), " ") & " "
strBodyMsg = strBodyMsg & Nz(DLookup("[OwnerFirstName]", "tblOwnerInfo", "[OwnerID]=" & lngID), " ") & " "
strBodyMsg = strBodyMsg & Nz(DLookup("[OwnerLastName]", "tblOwnerInfo", "[OwnerID]=" & lngID), "Client")
strBodyMsg = strBodyMsg & "," & Chr(10) & Chr(10) & Chr(13) _
& "Please find attached your Statement/Invoices, Dated:" & " " & Format(Date, "d-mmm-yyyy") & Chr(10) & "Your Statement Total: " & Format(tbAmount, "$ #,##.00") & Chr(10) & Chr(10) & Nz(DLookup("[EmailMessage]", "tblCompanyInfo"), "") & eMailSignature("Best Regards", True) & Chr(10) & Chr(10) & DownloadMessage("PDF") _


DoCmd.OutputTo acOutputReport, sndReport, strFormat, myfile1, False
If ckbTerms = True Then
DoCmd.OutputTo acOutputReport, "TermsAndConditions", strFormat, myfile3, False
End If
If mytot > 0 And ckbStateOnly = False Then
DoCmd.OutputTo acOutputReport, "Invoice", strFormat, myfile2, False
End If

CurrentDb.Execute "UPDATE tblOwnerInfo " & _
"SET EmailDateState = Now() " & _
"WHERE OwnerID = " & lngID & " AND " & cbOwnerName.Column(0), dbFailOnError 'OwnerChange



Dim myitem As Object ' Outlook.MailItem
Dim myout As Object 'Outlook.Application
Set myout = CreateObject("Outlook.Application") ' New Outlook.Application
Set myitem = myout.CreateItem(0) '(olMailItem)
With myitem
.To = strMail
.Cc = Nz(DLookup("EmailCC", "tblOwnerInfo", "OwnerID = " & lngID), "")
.Bcc = Nz(DLookup("EmailBCC", "tblOwnerInfo", "OwnerID = " & lngID), "")
.Subject = "Your Statement/Invoice" & " from " & Nz(DLookup("[CompanyName]", "tblCompanyInfo"))
.Body = strBodyMsg 'EditMessage:=blEditMail
.Attachments.Add myfile1
If ckbTerms = True Then
.Attachments.Add myfile3
End If
If mytot > 0 And ckbStateOnly = False Then
.Attachments.Add myfile2
End If
'On Error Resume Next
.Send
'On Error GoTo ErrorHandler
End With
Set myitem = Nothing
Set myout = Nothing
cbOwnerName.SetFocus

Case Else
Exit Sub

End Select
ExitProc:



Exit_Command35_Click:
Exit Sub

Err_Command35_Click:
MsgBox Err.Description
Resume Exit_Command35_Click

ErrorHandler:

msgTitle = "Untrapped Error"
msgBtns = vbExclamation

Select Case Err.Number
'User cancelled message (2293 & 2296 are raised
'by Outlook, not Outlook Express).
Case 2501, 2293, 2296
Case Else
MsgBox "Error Number: " & Err.Number & Chr(13) _
& "Description: " & Err.Description & Chr(13) & Chr(13) _
& "(frmBillStatement SendMailButton_Click)", msgBtns, msgTitle
End Select

Resume ExitProc


End Sub
 
OK, with Office 365, there is the option to use "NEW" Outlook, but that is not compatible with original Outlook. Check to see if your Outlook on the error machine is New Outlook. See if you can find the control to tell it to switch back. It is possible that the other machines are still on the Old Outlook and thus are doing fine.
 
Thanks Doc Man, Yes this is Outlook (New) , I dont see A option to revert to the old Outlook
Also I tried my database through Windows Live and got the same error
Thanks for your help.....Bob
 
There is an option somewhere, as a colleague used it a while back. Try googling.
 
Thanks Doc Man, Yes this is Outlook (New) , I dont see A option to revert to the old Outlook
Also I tried my database through Windows Live and got the same error
Thanks for your help.....Bob
Hi Bob,

Thanks for answering the question I asked in post #5. See if anything on the following page helps.
 
Thanks Doc Man, Yes this is Outlook (New) , I dont see A option to revert to the old Outlook
Also I tried my database through Windows Live and got the same error
Thanks for your help.....Bob

I could be wrong, but I am of the opinion that your Active X error is (a) an older error message that hasn't been updated lately and (b) is because New Outlook doesn't work the way Old Outlook does, even at the Component Object Model level... and COM is the basis for a lot of Access interactions with other office products.

I would say that IF you can find that "revert to Old Office" option and things start to work again, we have answered the question of "what broke?"
 
This Laptop came with Windows 10 pro, So I imagine Outlook New came with that. So cant go back to Outlook Classic. When downloading Windows Classic and try to install it, I am getting this message.



To install this product, first uninstall

Microsoft Visio Standard 2019

Microsoft Office Professional Plus 2019

Microsoft Project Standard 2019



Thanks for any help

Bob
 
This Laptop came with Windows 10 pro, So I imagine Outlook New came with that. So cant go back to Outlook Classic. When downloading Windows Classic and try to install it, I am getting this message.



To install this product, first uninstall

Microsoft Visio Standard 2019

Microsoft Office Professional Plus 2019

Microsoft Project Standard 2019



Thanks for any help

Bob
Perhaps, you could try switching to using CDO instead?


My demo doesn't include adding attachments, but the code for doing that is similar to the one for using Outlook.
 
It depends on the kit you are using. If those are LTSC copies, then they come in a type of bundle that doesn't seem to allow selective removal, or at least if it does, I haven't found that trick. Older CD-based kits WOULD allow selective removal and reinstallation of a single product, but it APPEARS to me that the LTSC model is "all or nothing at all" and thus can't do a selective remove/install.
 
If you definitely want to use Outlook Classic, then I would try.
Installing Belarc Adviser. This will give you the keys.
Remove Visio or the package I need/want the least.
Try installing again. If that works, then I would repeat with all three. If it does not, then I would go with below.

I have been running 2007 for years, but got tired not being able to open later version DBs here and elsewhere when trying to help.
So i purchased Office Pro 2019 from a site with key and installed that. It is registered and works fine. That cost was worth it to me should I wish to stick with Outlook Classic. As I write snippets of code in that I need the Classic, not the New.

You can PM me for where I got my Office from if you like.
Also, as always, I would be Googling
 
I did something similar with Office 2021, Gasman. More or less the same reason, plus the fact that I was considering an upgrade to my old machine before it died and that was a first step. (Then when the old machine DID have the ill grace to croak, I went through with the upgrade to 2021.)
 

Users who are viewing this thread

Back
Top Bottom