IFF with DLookup function produced #Name?

Lissa

Registered User.
Local time
Yesterday, 18:05
Joined
Apr 27, 2007
Messages
114
Hi All,
I was wondering if someone could point out what I'm doing wrong...
I have a (parent) form with 2 subforms. I would like the field in one subform to look at the value in the other subform... if that value is null I would like the field to display "N/A" otherwise I want it to perform a DLOOKUP....
I have the following but I'm not sure if I'm referencing the subform field correctly... I keep getting the #Name? when viewing the field from the parent form's display.

=IIf(IsNull(subfrmPROPOSALSetup.Form!LaborCategory1),"N/A",DLookUp("LaborCategory1","LABOR","ProposalID=" & Forms!frmPROPOSALSetup!ProposalID))

Thanks in advance! :)
 
Last edited:
I have a similar one in one of my dbs. It could very well be your referencing of the subform and subform control

Try this...

Also should there be a gap in your "labourCategory 1"??

Code:
IIf(IsNull([Forms]![frmPROPOSALSetup]![subfrmPROPOSALSetup]![LaborCategory 1]),"N/A",DLookUp("LaborCategory1","LABOR","[ProposalID ]=" & Forms!frmPROPOSALSetup!ProposalID))

Here is mine - please adapt to your db as see if it works, if the above fails...

Main form is the frmClients
Sub form is the sfmSites
which in turn has a subform sfmSamples
Code:
IIf(IsNull([Forms]![frmClients]![sfmSites].[Form]![sfmSamples].[Form]![SampID]),"N/A",DLookUp("ClientName","tblClients","[Clientid]=" & [Forms]![frmClients]![LogId]))
 
Kiwiman -
Thanks for responding :) I tried your example and that didn't quite work but it made me think of something else to try...

This worked for me...

=IIf(IsNull(DLookUp("LaborCategory1","LABOR","[ProposalID ]=" & Forms!frmPROPOSALSetup!ProposalID)),"N/A",DLookUp("LaborCategory1","LABOR","[ProposalID ]=" & Forms!frmPROPOSALSetup!ProposalID))
 

Users who are viewing this thread

Back
Top Bottom