7 Replies Latest reply: May 15, 2014 9:52 AM by Nick Osdale-Popa RSS

    Visual Basic app bombs

    oxfordfire _

      I've got a VB app that loads data extracted with Monarch into a MS access db.  Works fine on my development machine, but I get this error when running it on a client machine:  Run-Time Error '429': ActiveX component can't create object.  Any ideas??????

        • Visual Basic app bombs
          Jeff S

          It sounds like either the client machine doesn't have the component you are trying to create (Monarch?) installed or it isn't properly registered.

          • Visual Basic app bombs
            oxfordfire _

            I installed Monarch on the client machine & it still won't work.  Bombs on the very 1st Set statement. Can't find the object.  Here's the code:

             

            Private Sub Form_Load()

             

            Dim MonarchObj As Object

            Dim openfile As Variant

            Dim openmod As Variant

            Dim t As Boolean

             

            Set MonarchObj = GetObject("", "Monarch32")

             

            If MonarchObj Is Nothing Then

                Set MonarchObj = CreateObject("Monarch32")

            End If

             

            t = MonarchObj.SetLogFile("C:MonTempMPrg_G5.log", False)

             

            openfile = MonarchObj.SetReportFile("W:LocalAppsPOVariancePOVariance.txt", False)

            If openfile = True Then

                openmod = MonarchObj.SetModelFile("W:LocalAppsPOVarianceActual Price #1.mod")

                    If openmod = True Then

                        MonarchObj.JetExportTable ("W:LocalAppsPOVarianceActualPrice.mdb"), ("Invoices"), (2)

                            Else

                        MsgBox "Database Was NOT Created"

                        Exit Sub

                    End If

            End If

             

            If openfile = True Then

                    openmod = MonarchObj.SetModelFile("W:LocalAppsPOVarianceActual Price #2.mod")

                If openmod = True Then

                    MonarchObj.JetExportTable ("W:LocalAppsPOVarianceActualPrice.mdb"), ("Invoices"), (2)

                      Else

                   MsgBox "Database Was NOT Created"

                   Exit Sub

                End If

            End If

             

            MonarchObj.CloseAllDocuments

            MonarchObj.Exit

             

            Unload Me

             

            End Sub

            • Visual Basic app bombs
              RalphB _

              Another possibility is do you have the latest updates for you OS on the client machine including ActiveX drivers.  I believe we had something similar here at work.  We got the latest updates for the OS and ActiveX and it seemed to work ok after that.  The machine even seemed to run faster.

              • Visual Basic app bombs
                oxfordfire _

                I took out the reference to the ActiveX control in the VB app & no longer get the Control error.  The error I get now is it can't find the MonarchObj file/object.

                • Visual Basic app bombs
                  Nick Osdale-Popa

                  The reason for the Error: Run-Time Error '429': ActiveX component can't create object, is because of these lines:

                  [font="courier"]Set MonarchObj = GetObject("", "Monarch32")

                   

                  If MonarchObj Is Nothing Then

                      Set MonarchObj = CreateObject("Monarch32")

                  End If[/font][/quote]In the first instance, if there is not an already running version of Monarch you will get an error.

                   

                  You should add in your error checking as such.

                  [font="courier"]On Error Resume Next

                  Set MonarchObj = GetObject("", "Monarch32")

                  Error.Clear

                   

                  If MonarchObj Is Nothing Then

                      Set MonarchObj = CreateObject("Monarch32")

                  End If[/font][/quote]This will allow your code to continue after it tries to set MonarchObj. Error.Clear will reset the Error Handling to catch any additional errors that may occur.

                   

                  As for your second problem, I'm not sure what the problem could be.  May want to uninstall/install Monarch.

                   

                   

                  Originally posted by oxfordfire:

                  I installed Monarch on the client machine & it still won't work.  Bombs on the very 1st Set statement. Can't find the object.  Here's the code:

                   

                  Private Sub Form_Load()

                   

                  Dim MonarchObj As Object

                  Dim openfile As Variant

                  Dim openmod As Variant

                  Dim t As Boolean

                   

                  Set MonarchObj = GetObject("", "Monarch32")

                   

                  If MonarchObj Is Nothing Then

                      Set MonarchObj = CreateObject("Monarch32")

                  End If

                   

                  t = MonarchObj.SetLogFile("C:MonTempMPrg_G5.log", False)

                   

                  openfile = MonarchObj.SetReportFile("W:LocalAppsPOVariancePOVariance.txt", False)

                  If openfile = True Then

                      openmod = MonarchObj.SetModelFile("W:LocalAppsPOVarianceActual Price #1.mod")

                          If openmod = True Then

                              MonarchObj.JetExportTable ("W:LocalAppsPOVarianceActualPrice.mdb"), ("Invoices"), (2)

                                  Else

                              MsgBox "Database Was NOT Created"

                              Exit Sub

                          End If

                  End If

                   

                  If openfile = True Then

                          openmod = MonarchObj.SetModelFile("W:LocalAppsPOVarianceActual Price #2.mod")

                      If openmod = True Then

                          MonarchObj.JetExportTable ("W:LocalAppsPOVarianceActualPrice.mdb"), ("Invoices"), (2)

                            Else

                         MsgBox "Database Was NOT Created"

                         Exit Sub

                      End If

                  End If

                   

                  MonarchObj.CloseAllDocuments

                  MonarchObj.Exit

                   

                  Unload Me

                   

                  End Sub /b[/quote]

                  • Visual Basic app bombs
                    oxfordfire _

                    Here's the error I'm getting after installing Monarch on the client:

                     

                    Run-time error '-2147024894(80070002)':

                    Automation error

                    The system cannot find the file specified.

                     

                    This error happens on the following statement:

                     

                    Set MonarchObj = CreateObj("Monarch32")

                     

                    Any more ideas??????????

                    • Visual Basic app bombs
                      Nick Osdale-Popa

                      You might want to try it with early binding:

                       

                      Set a reference to the Monarch Object:

                      C:Program FilesMonarchProgrammonarch.tlb

                       

                      Or where ever you installed Monarch. You need the monarch.tlb file.

                       

                      NOTE: I haven't had any success with this approach. I always get class does not allow automation error.