cancel
Showing results for 
Search instead for 
Did you mean: 

Error getting UDF value

Former Member
0 Kudos

Hi,

I'm trying to get the values from some standard fields and some UDFs on the Sales Order form

Everything works fine for the standard fields but I get an error on the UDFs

Here's my code

'This bit works fine

Set oForm = SBO_Application.Forms.Item(FormUID)

Set oItem = oForm.Items.Item("8")

Set oEditText = oItem.Specific

strDocNum = oEditText.String

'This bit doesn't work

Set oForm = SBO_Application.Forms.GetFormByTypeAndCount(-139, 1)

Set oItem = oForm.Items("U_CrPrj")

'The next line causes a type mismatch error????

Set oEditText = oItem.Specific

strDocNum = oEditText.String

Anyone out there have any idea where I'm goin wrong?

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

That was exactly the problem!

Cheers, thanks for that

Former Member
0 Kudos

Hi

Probably, oForm.Items("U_CrPrj") is not an EditText item.

You can get type of the object using VBA.TypeName function.

Something like this:

Set oItem = oForm.Items("U_CrPrj")

Debug.Print TypeName(oItem.Specific)

Result will be printed in the immediate window.