@ Bob,
I modified your query so that when the YN column is No, the debt field is returned:
Code:
NEW: IIf(Len([ParentComp] & "")<=0,[debt],DLookUp("debt","sheet1","[CName] = '" & [parentcomp] & "'"))
If the field = "No", then return the debt it has, ex.
Comp1 would return a debt of 504.
Here is the SQL of the query
Code:
SELECT Sheet1.CName, IIf(Len([ParentComp])>0,"Yes","No") AS YN, Sheet1.debt, Sheet1.ParentComp, IIf(Len([ParentComp] & "")<=0,[debt],DLookUp("debt","sheet1","[CName] = '" & [parentcomp] & "'")) AS NEW
FROM Sheet1;