Code:
'* Test relational lookups
If fValdt(ValCol, 13) <> "" And FldVal <> "" Then 'if lookup doesn't exist then error
temp1 = "ID="
If Left(fValdt(ValCol, 2), 2) = "Nu" Or fValdt(ValCol, 2) = "Cu" And IsNumeric(FldVal) Then temp1 = temp1 & Str(FldVal) Else temp1 = temp1 & fQt(FldVal)
temp2 = DLookup(fValdt(ValCol, 14), fValdt(ValCol, 13), temp1) 'get a field from a foreign record
temp3 = DLookup("Ps", fValdt(ValCol, 13), temp1) 'get processing status for the related record
If IsNull(temp2) Or temp3 = 0 Or (fValdt(ValCol, 15) <> "" And fSaLocate(fValdt(ValCol, 15), CStr(Nz(temp2, ""))) = 0) Then
pSp(2) = fValdt(ValCol, 13)
sAddStatus Frm, fCntl, fTranltLang(TempVars!loLangID, "3_Ie51", "H", pSp), fCntl(6, 1), , , aValAll
gError = nProc & "\51": GoTo ExitCd
ElseIf fValdt(ValCol, 14) = "GrpN" Then
temp2 = fSaExtract(fValdt(ValCol, 13), 3, "_")
temp3 = DLookup("LvlN", fValdt(ValCol, 13), temp1)
If temp2 = "Group" And temp3 <> 1 Then
sAddStatus Frm, fCntl, fTranltLang(TempVars!loLangID, "3_Ie52", "H", pSp), fCntl(6, 1), , , aValAll
gError = nProc & "\52": GoTo ExitCd
End If
End If
End If