How to get error code from Custom Code | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

How to get error code from Custom Code

I have added the custom code below to my report and am trying to call it with this code
=AzaleaEAN8("1234567") Everything compiles, but I get an #Error instead of the expected string.
The code works in a standard ASP.NET page without issue. Is anyone aware of a way to return the actual error code that is being generated? Thanks,
Jim SAMPLE CODE Declare Sub BarcodeEAN8 Lib "barcode.dll" ( _
ByVal FontString As String, _
ByVal ProductCode As String) Public Function AzaleaEAN8(ByVal ProductCode As String) As String If Len(ProductCode) = 7 Then
Dim outBuff As String ‘A resonable buffer size
outBuff = Space(15) BarcodeEAN8(outBuff, ProductCode) AzaleaEAN8 = outBuff
Else
AzaleaEAN8 = ""
End If End Function
]]>