To retrieve a specific record, LceFetch is used. Before calling LceFetch, the value of the key used in the search is set using LceSetFieldValue.

If LceFetch returns LceTrue (1), LceGetFieldValueX can then be used to retrieve the data.

     Private Sub lstSkills_Click()
    ' synchronize fields with list    
    
    If (lstSkills.ListIndex > -1) Then
        ' Read record
        iRet = LceSetFieldValue(iSession, "SKILCODE", mycode) ' Set Key
        '--------- --------------------------------------------
        iRet = LceFetch(iSession, "SKILCODE,SKILDESC", "SKLTAB", _
                  "SKILCODE") ' Get Record
        '---------------------------------------------------------
        If iRet = LceTrue Then
            ' set code
            sBuff = String(FIELD_DATA_SIZE, Chr(0)) _
                     ' required when calling dlls
            iRet = LceGetFieldValueX(iSession, "SKILCODE", sBuff, lFlags) _
                    ' Get Field
            '------------------------------------------------------
            If lFlags = 1 Then
               txtCode = "Null value"
            Else
               txtCode = sTrim(sBuff) ' display data
            End If
           
            ' set desc
            iRet = LceGetFieldValueX(iSession, "SKILDESC", sBuff, lFlags)
            '------------------------------------------------------
            If lFlags = 1 Then
               txtDesc = "Null value"
            Else
               txtDesc = sTrim(sBuff)
            End If
        End If
       
    End If
 
    Exit Sub
    
End Sub
  • No labels