I have this formula that works on a form.  It's in an unbound text box.
	
	
	
		
However, if I copy and paste this into the Field line of a new column in a Query, and give it a title like FRRotorPart: then I assumed this would work:
	
	
	
		
But all I get is an #Error. If I remove the IIF portion then the dlookup works just fine. What am I missing?
 
		Code:
	
	
	IIf([FRRotorsReplaced]="New",DLookUp("[FrontRotorPart]","[BrakePartsGroup]","[AssetGroup]='" & [AssetGroup] & "'"),0)However, if I copy and paste this into the Field line of a new column in a Query, and give it a title like FRRotorPart: then I assumed this would work:
		Code:
	
	
	FRRotorPart: IIf([FRRotorsReplaced]="New",DLookUp("[FrontRotorPart]","[BrakePartsGroup]","[AssetGroup]='" & [AssetGroup] & "'"),0)But all I get is an #Error. If I remove the IIF portion then the dlookup works just fine. What am I missing?
 
	 
 
		 
 
		
 
 
		
 .... I was brain dead when I wrote that post and have now added a correction
.... I was brain dead when I wrote that post and have now added a correction