troubleshooting Question

How to resolve the following error when trying to use a browse button "Active X component can't create object"

Avatar of K Dinsmore
K DinsmoreFlag for United States of America asked on
Microsoft AccessMicrosoft DevelopmentWeb Components
10 Comments1 Solution738 ViewsLast Modified:
Hi Experts. [Olaf are you out there?!]

I'm trying to use this code (below) via a button to allow my users to attach/embed a proof (.pdf file) in the job log (yes... still working on this job log - :p)

The code (which thank goodness I found posted here because it's exactly what I needed)
-------------------
Private Sub btnBrowse_Click()

    On Error GoTo err_btnBrowse_Click
   
    Const cdlOFNFileMustExist = 4096
    Const cdlOFNHideReadOnly = 4
    Const cdlCancel = 32755
   
    Dim dlgBrowse As Object
   
    Dim fullName As String, fileName As String
   
    Set dlgBrowse = CreateObject("MSComDlg.CommonDialog")
   
    dlgBrowse.CancelError = True

    'Change the line below to filter those file types you want to allow.  The part before the pipe symbol ("|") is just a text description of the filter.  The part after actually defines the filter.

    dlgBrowse.Filter = "Images (*.gif;*.bmp)|*.gif;*.bmp"

    dlgBrowse.FilterIndex = 1
    dlgBrowse.Flags = cdlOFNFileMustExist + cdlOFNHideReadOnly
    dlgBrowse.DialogTitle = "Browse for Image"
    dlgBrowse.MaxFileSize = 2048
   
    dlgBrowse.ShowOpen
   
    fullName = dlgBrowse.fileName
   
    'Replace BoundOLE reference to the name of your Bound Object Control
    BoundOLE.SourceDoc = fullName
    BoundOLE.Action = acOLECreateEmbed
   
exit_btnBrowse_Click:

    Set dlgBrowse = Nothing
    Exit Sub
   
err_btnBrowse_Click:

    If Err.Number <> cdlCancel Then  'replace following with your own error handling code
        MsgBox Err.Description, vbExclamation, "Error: " & Err.Number
    End If
       
    Resume exit_btnBrowse_Click
   
End Sub
--------------------------
I've replaced the following lines (as noted by the author)

    'Replace BoundOLE reference to the name of your Bound Object Control
    BoundOLE.SourceDoc = fullName
    BoundOLE.Action = acOLECreateEmbed

to:

    'Replace BoundOLE reference to the name of your Bound Object Control (mine was JobProof)
    JobProof.SourceDoc = fullName
    JobProof.Action = acOLECreateEmbed
--------
note: JobProof is the field I want to store the OLE object (ultimately a .pdf)
------------------------------------

I've also changed the following lines:

    'Change the line below to filter those file types you want to allow.  The part before the pipe symbol ("|") is just a text description of the filter.  The part after actually defines the filter.

    dlgBrowse.Filter = "Images (*.gif;*.bmp)|*.gif;*.bmp"

to:

    dlgBrowse.Filter = "Images (*.gif;*.bmp)|*.pdf"

-------------
Problem 1:
Not sure if I've referenced everything correctly?!

Problem 2: (seems like the bigger issue)
I continue to get the error message "Active X component can't create object" when I go to click the button. I've done some research, both here on EE as well as Microsofts site - both suggest the following:

· Try registering the active x control via:
Start > Run > regsvr32 "C:\Program Files\Common Files\Microsoft Shared\DAO\DAO360.dll"

I did this, and it appeared to be successful, but I continue to get the error.

I've also tried to check my references (?) and nothing shows up missing (although I don't really have the skillset at this stage to know for certain)

I have no idea how to resolve this but I really need this functionality in the database. The button will ultimately read "Attach Proof" and prompt the user to browse their local hard drive for the actual proof which will be then be stored in the JobProof field of the the JobTicket.

Help is very-much appreciated!

Cheers! Katie (a.k.a. DesignCityStudio)



When trying to run the source code

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros