6.15.1 VB Example
Sub SetCurrentEmployee(EmpNo As String)
' Set Employee EmpNo as the active record
If EmpNo <> "" Then
' set the key value for this fetch
iRet = LceSetFieldValue(iSession, "EMPNO", EmpNo)
' get the selected employee details
If iRet = LceTrue Then
iRet = LceFetch(iSession, _
"EMPNO,SURNAME,GIVENAME,ADDRESS1,ADDRESS2," & _
"ADDRESS3,POSTCODE,PHONEHME,PHONEBUS," & _
"DEPTMENT,SECTION,STARTDTE,TERMDATE,SALARY", _
"PSLMST", "EMPNO")
If iRet = LceTrue Then
' Call GetFieldValues to retrieve values.
End If
End If
Else
' Handle error
End If
End Sub
Sub GetFieldValues()
Dim sBuff As String
Dim lFlags As Long
sBuff = String(FIELD_DATA_SIZE, Chr(0)) ' set buffer
' read field values and set text boxes
' EmpNo
iRet = LceGetFieldValueX(iSession, "EMPNO", sBuff, lFlags)
txtEmpNo.Text = sTrim(sBuff)
' Surname
iRet = LceGetFieldValueX(iSession, "SURNAME", sBuff, lFlags)
txtSurname.Text = sTrim(sBuff)
' Givename
iRet = LceGetFieldValueX(iSession, "GIVENAME", sBuff, lFlags)
txtGiven.Text = sTrim(sBuff)
…
' PHONEBUS
iRet = LceGetFieldValueX(iSession, "PHONEBUS", sBuff, lFlags)
if lFlags = 1 then
txtBusPhone.Text = ""
Then
txtBusPhone.Text = sTrim(sBuff)
End If
End Sub