partadapter.GetByID question Epicor 9

Never mind, I figured out how to catch the error.

Eric

--- In vantage@yahoogroups.com, "ericzuerche" <ezuercher@...> wrote:
>
> I'm using GetByID to validate a custom field on the part form that is linked to ShortChar02 in the PartRev table. The validation is triggered by after field change and it's meant to confirm that the number that the user has entered is a valid part number that exists in the Part table. If the user has entered an invalid part number, then I want to bring up an informational message box to let the user know, and the field keeps the new (invalid) value.
>
> Everything works fine when the user has entered a valid part. However, when the user enters a part that is not in Part table, the call to GetByID seems to revert the field on the form to its previous value, and the message box never appears. Here is the code:
>
> Dim myPartNum as String
> myPartAdapter = New PartAdapter(oTrans.epiBaseForm)
> myPartAdapter.boConnect
>
> Select Case args.Column.ColumnName
>
> Case "ShortChar02" 'Assembly Drawing
> If edvPartRev.dataView.Table.Columns.Contains("ShortChar02") Then
> myPartNum = edvPartRev.dataView(edvPartRev.row)("ShortChar02")
> dim found as Boolean = myPartAdapter.getByID(myPartNum)
> If not found then
> messagebox.show("That's not a valid part number, Knucklehead.")
> End If
> End If
>
>
> Any ideas on what I'm doing wrong?
>
> Thanks,
> Eric
>
I'm using GetByID to validate a custom field on the part form that is linked to ShortChar02 in the PartRev table. The validation is triggered by after field change and it's meant to confirm that the number that the user has entered is a valid part number that exists in the Part table. If the user has entered an invalid part number, then I want to bring up an informational message box to let the user know, and the field keeps the new (invalid) value.

Everything works fine when the user has entered a valid part. However, when the user enters a part that is not in Part table, the call to GetByID seems to revert the field on the form to its previous value, and the message box never appears. Here is the code:

Dim myPartNum as String
myPartAdapter = New PartAdapter(oTrans.epiBaseForm)
myPartAdapter.boConnect

Select Case args.Column.ColumnName

Case "ShortChar02" 'Assembly Drawing
If edvPartRev.dataView.Table.Columns.Contains("ShortChar02") Then
myPartNum = edvPartRev.dataView(edvPartRev.row)("ShortChar02")
dim found as Boolean = myPartAdapter.getByID(myPartNum)
If not found then
messagebox.show("That's not a valid part number, Knucklehead.")
End If
End If


Any ideas on what I'm doing wrong?

Thanks,
Eric