Home Forums Share Code & Programming Solutions Error 97: cannot call friend function on object which is not an instance ..class

This topic contains 4 replies, has 3 voices, and was last updated by  Tomas Beblar 1 year, 6 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #13739

    Premium Member

    The below code returns Run Time Error 97 – Can not call friend on object which is not an instance of defining class.

    Option Compare Database

    Public Static Sub QBCostCodeTest()
    Dim QBC As QBConnection
    Dim QBItem As qcItem
    Dim strString As String
    Set QBC = QBConnection
    ‘, “\\ramqb01\e$\RAM\EVG testing\Evergreene Companies Test.qbw”
    QBC.Connect “”, “MyAppName”, qbOpenModeDontCare, “”, “Q:\RAM\EVG Testing\MyQuickBooksDatabaseName.qbw”
    QBC.Company.Items.GetAll qbItemService
    Set QBItem = QBC.Company.Items(100)
    Debug.Print QBItem.Name
    Items.Rename QBItem, “1118 Eng – Driveways”
    End Sub


    Tom Crawford

    Make sure you commit the item after renaming it. Here is an example:

    Dim oI As qcItem

    QBConnection.Connect “”, APP_NAME, qbOpenModeDontCare, ACCESS_CODE

    Set oI = Items.GetByFullName(“Framing”)
    Items.Rename oI, “Framing New Name”
    Items.Commit oI


    Premium Member

    I should have mentioned that:
    1. The error occurs on the line: Items.Rename QBItem, “1118 Eng – Driveways”, so Items.Commit will not even run.
    2. This exact same code works for renaming Venders and Customers, but errors on Items.


    Tom Crawford

    What version of the library do you have? You can download the latest from http://download.synergration.com/coreobjx70.zip

    Make sure you register them using REGSVR32.EXE


    Tomas Beblar
    Premium Member

    Same problem. No solution found.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.