Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Obtaining AR Cust Terms Code 1

Status
Not open for further replies.

Bluejay07

Programmer
Mar 9, 2007
780
CA
Hello,

I am creating a program using VB6. I am interested in obtaining the terms code solely based on the description.

Code:
   Dim ARRTA As AccpacCOMAPI.AccpacView
   
   On Error GoTo ERR_Handler
   
   If Trim$(pTDesc) = "" Then Exit Function
   
   mpDBLINK.OpenView "AR0016", ARRTA
   With ARRTA

      '.Browse "TEXTDESC = " & Trim$(pTDesc) & "", True
      'If .Fetch Then

      .Fields("TEXTDESC").Value = Trim$(pTDesc)
      If .Read Then
         Return_CustTermsCode = Trim$(.Fields("CODETERM").Value)
      End If
   End With
   Set ARRTA = Nothing
   Exit Function

The .read doesn't find it and just passes over it and the .browse returns 'Terms Code Critical Error'.

I have also verified that the description passed over matches exactly the terms code description.

Could anyone provide insight as too what I may be doing wrong?

Thanks.
 
.Read will not work since TEXTDESC is not an indexed field, you can only use >read with indexed fields.
 
Thanks for the reply.

Would you have any suggestion if this can be done another way?
 
Change your .Browse and add .Init:

.Init
.Browse "TEXTDESC = " & chr(34) & Trim$(pTDesc) & chr(34), True
If .Fetch Then

 
Thank you again for the valued imput.

Your help is greatly appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top