• 2115 run time error (Office 2003)

    Author
    Topic
    #448519

    Hi all,

    Stuck again! I am getting a runtime error 2115 after running the code listed below. The me.refresh line triggers the error. What I can’t seem to grasp here is that if I remove that line and just close the form, the table updates and there is no error. However, I need the form to stay open and when I refresh or requery the form, I get the error. Can someone give me a pointer on how to fix this issue.

    Thanks
    Kevin

    Code:

    Private Sub Check354_AfterUpdate()
    DoCmd.SetWarnings False

    ‘DoCmd.Requery

    ‘ Attach TAR Report
    If (Forms![Splash Screen]![vSecurity] = 70) Then
    If Me!Check354 = True Then

    Dim mySQL As String
    Dim vPricingPackage As String
    vPricingPackage = Forms![Splash Screen]![vLastPricing]

    DoCmd.OpenForm “frmSelectFileXP”, acNormal, , , , acDialog

    oleTechnicalReport.Class = “Excel.Sheet” ‘ Set class name.
    ‘ Specify type of object.
    oleTechnicalReport.OLETypeAllowed = acOLELinked
    ‘ Specify source file.
    oleTechnicalReport.SourceDoc = Me.vTARReportName
    ‘ Specify data to create link to.
    ‘TechnicalReport.SourceItem = “R1C1:R25C15”
    ‘ Create linked object.
    oleTechnicalReport.Action = acOLECreateLink
    ‘ Adjust control size.
    oleTechnicalReport.SizeMode = acOLESizeZoom

    Me.Desk_TAR_Complete = True

    Forms![Splash Screen]![vTechReportName] = Me.vTARReportName

    End If
    End if
    Me.Refresh

    … more code

    Viewing 0 reply threads
    Author
    Replies
    • #1097028

      Do you get the same error if you use the following line?

      RunCommand acCmdSaveRecord

      • #1097029

        Thanks Hans,

        Just tried that on and I get the same message.

        kevin

        • #1097031

          There must be something else preventing you from saving the record, but I have no way of knowing what it is without seeing the database. Could you post a stripped down copy of your database? See post 401925 for instructions.

          • #1097032

            Hans,

            Before I do that, (huge under taking), I tried eliminating parts of that event one at a time. and if I leave everything else alone and just comment out the OLE lines (as below)…


            Private Sub Check354_AfterUpdate()
            DoCmd.SetWarnings False

            ‘DoCmd.Requery

            ‘ Attach TAR Report
            If (Forms![Splash Screen]![vSecurity] = 70) Then
            If Me!Check354 = True Then

            Dim mySQL As String
            Dim vPricingPackage As String
            vPricingPackage = Forms![Splash Screen]![vLastPricing]

            DoCmd.OpenForm “frmSelectFileXP”, acNormal, , , , acDialog

            ‘ oleTechnicalReport.Class = “Excel.Sheet” ‘ Set class name.
            ‘ Specify type of object.
            ‘ oleTechnicalReport.OLETypeAllowed = acOLELinked
            ‘ Specify source file.
            ‘ oleTechnicalReport.SourceDoc = Me.vTARReportName
            ‘ Specify data to create link to.
            ‘TechnicalReport.SourceItem = “R1C1:R25C15”
            ‘ Create linked object.
            ‘ oleTechnicalReport.Action = acOLECreateLink
            ‘ Adjust control size.
            ‘ oleTechnicalReport.SizeMode = acOLESizeZoom

            Me.Desk_TAR_Complete = True

            Forms![Splash Screen]![vTechReportName] = Me.vTARReportName

            End If

            RunCommand acCmdSaveRecord

            … more code

            It works fine. Is there something unique that I might be missing as far as the OLE routine? Am I better off having the users get to the report some other way than linking to it in this way?

            Thanks

            Kevin

            • #1097033

              You could simply open the workbook, for example using Application.FollowHyperlink or ShellExecute (do a search in this forum for examples of the latter).

            • #1097034

              Thanks Hans,

              I will pick up with that in the morning.

              Kevin

    Viewing 0 reply threads
    Reply To: 2115 run time error (Office 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: