Skip to Content
author's profile photo Former Member
Former Member

Ref Count higher than 0

Hi All,

I get the above error in my addon. After getting this error it says "Payroll Addon has stopped working". I know this error is because of not releasing the meta data objects. But all the meta data objects in my code are released.

I dont get this error

1) when I debug the program

2) When I run the program in new db.

Below is the code I use for creating tables.

Private Sub AddTables(ByVal strTab As String, ByVal strDesc As String, ByVal nType As SAPbobsCOM.BoUTBTableType)

Dim oUserTablesMD As SAPbobsCOM.UserTablesMD


oUserTablesMD = oApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables)

'Adding Table

If Not oUserTablesMD.GetByKey(strTab) Then

oUserTablesMD.TableName = strTab

oUserTablesMD.TableDescription = strDesc

oUserTablesMD.TableType = nType

If oUserTablesMD.Add <> 0 Then

Throw New Exception(oApplication.Company.GetLastErrorDescription)

End If

End If

Catch ex As Exception

Throw ex



oUserTablesMD = Nothing



End Try

End Sub

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 26, 2013 at 12:27 PM


    This can happen if you use some other DI object (such Recordset or others) before you call the AddTables sub.

    In such cases you should release those objects too.


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.