DLookup within DLookup not working

brunopg7

Registered User.
Local time
Yesterday, 19:05
Joined
Apr 20, 2011
Messages
14
Hi this is working:
=IIf(Forms!GARF!GARFsubForm![finished_good_#]<>"", DLookUp("[CustomerSKU]","ItemCustomerSKU", "ItemNumber = '" & Forms!GARF!GARFsubForm![finished_good_#] & "' AND Customer = '" & Forms!GARF![customer] & "' AND Company = '" & Forms!GARF![company] & "' AND MarketingSeason = '" & DLookUp("
Code:
","IDtoCode", "ID = " & Forms!GARF![season_id]) & "'"),"")

This is not working:
=IIf(Forms!GARF!GARFsubForm![finished_good_#]<>"", DLookUp("[CustomerSKU]","ItemCustomerSKU", "ItemNumber = '" & Forms!GARF!GARFsubForm![finished_good_#] & "' AND Customer = '" & Forms!GARF![customer] & "' AND Company = '" & Forms!GARF![company] & "' AND MarketingSeason = '" & DLookUp("[Code]","IDtoCode", "ID = " & Forms!GARF![season_id]) & "' AND Season = " & Forms!GARF![year]),"")

What am I doing wrong?
 
Why is it not working?
Do you get an error message?

You are nesting The Dlookups three levels deep in an IIF statement!

Create a function instead of an complex in-line IIF statement when it gets to difficult to read. Future generations will be gratefull when you do.

Share & Enjoy!
 
What am I doing wrong?

What are you trying to do? In plain English.

You are familiar with your environment and your database. The rest of us are not.
So, for us to offer advice, you should try to be clear on what you are trying to accomplish; what you have tried; and what results (error messages/outputs) that you have received.
 
I'm with jdraw on this one. More information about what it is you are really wanting in that text box and why you are using DLookups to accomplish it would be most helpful. There may be a much more efficient way to do what you want but unless we understand what you want, we can't make suggestions.
 

Users who are viewing this thread

Back
Top Bottom