Dlookup

  • Thread starter Claudette Hennessy
  • Start date
C

Claudette Hennessy

=DLookUp("[Bldg] & ' ' & [BoothNum]","tblEvent","ShowID = 1 and ShopID = "
& Forms!frmContractUpdate!cboShopID)

I am getting wrong values for the case that the where clause is not
satisfied(I seem to remember Dlookup does this); I want to write
IIF( no case where a record satifies the conditions,"nodata",DLookUp("[Bldg]
& ' ' & [BoothNum]","tblEvent","ShowID = 1 and ShopID = " &
Forms!frmContractUpdate!cboShopID))
How do I do this?
Thank you in advance
Claudette Hennessy
 
T

Tom Lake

Claudette Hennessy said:
=DLookUp("[Bldg] & ' ' & [BoothNum]","tblEvent","ShowID = 1 and ShopID =
" & Forms!frmContractUpdate!cboShopID)

I am getting wrong values for the case that the where clause is not
satisfied(I seem to remember Dlookup does this); I want to write
IIF( no case where a record satifies the
conditions,"nodata",DLookUp("[Bldg] & ' ' &
[BoothNum]","tblEvent","ShowID = 1 and ShopID = " &
Forms!frmContractUpdate!cboShopID))
How do I do this?
Thank you in advance
Claudette Hennessy

You could try this:

=IIf(IsNull(DLookUp("[Bldg] & ' ' & [BoothNum]", "tblEvent","ShowID = 1
and ShopID = "
& Forms!frmContractUpdate!cboShopID), "No Data", DLookUp("[Bldg] & ' ' &
[BoothNum]", "tblEvent", "ShowID = 1 and ShopID = "
& Forms!frmContractUpdate!cboShopID))

Tom Lake
 
C

Claudette Hennessy

Thank you very much, I had some mistake in the syntax and couldn't find it.
This works after I put one more ")" in the expression, ie
=IIf(IsNull(DLookUp("[Bldg] & ' ' & [BoothNum]", "tblEvent","ShowID = 1
and ShopID = "
& Forms!frmContractUpdate!cboShopID)), "No Data", DLookUp("[Bldg] & ' ' &
[BoothNum]", "tblEvent", "ShowID = 1 and ShopID = "
& Forms!frmContractUpdate!cboShopID))
Claudette


Tom Lake said:
Claudette Hennessy said:
=DLookUp("[Bldg] & ' ' & [BoothNum]","tblEvent","ShowID = 1 and ShopID
= " & Forms!frmContractUpdate!cboShopID)

I am getting wrong values for the case that the where clause is not
satisfied(I seem to remember Dlookup does this); I want to write
IIF( no case where a record satifies the
conditions,"nodata",DLookUp("[Bldg] & ' ' &
[BoothNum]","tblEvent","ShowID = 1 and ShopID = " &
Forms!frmContractUpdate!cboShopID))
How do I do this?
Thank you in advance
Claudette Hennessy

You could try this:

=IIf(IsNull(DLookUp("[Bldg] & ' ' & [BoothNum]", "tblEvent","ShowID = 1
and ShopID = "
& Forms!frmContractUpdate!cboShopID), "No Data", DLookUp("[Bldg] & ' ' &
[BoothNum]", "tblEvent", "ShowID = 1 and ShopID = "
& Forms!frmContractUpdate!cboShopID))

Tom Lake
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Dlookup syntax 4
Dynamic Fields in Crosstab 2
dlookup looks to the wrong place 2
Yet another DLookup problem! 5
dlookup problem 4
Autofill/DLookUp 1
DLookup Not Working 3
Sum value from Dlookup function 1

Top