SOLVED

DCount

Steel Contributor

Hello Experts,

 

I am wanting to check if a table [Import_Excel_FBL1N] has a match on [InvNo].  I am not sure if Dcount is the best way to do this?   

 

Import_Excel_FBL1N.Reference = TEXT

InvNo = TEXT

 

It sometimes returns a #Error which leads me to believe I am doing something wrong or if I need an Nz check possibly? 

 

=IIf(DCount("*","Import_Excel_FBL1N","[Reference] =" & [InvNo])>0,"Yes","No")

 

I hope it makes sense.  Any questions please let me know.  

 

2 Replies
best response confirmed by Tony2021 (Steel Contributor)
Solution
If InvNo is text, you need to wrap it in single-quotes:
=IIf(DCount("*","Import_Excel_FBL1N","[Reference] ='" & [InvNo] & "'")>0,"Yes","No")
ahh yes. the text quotes. I forget about this too often. thank you. It works now.
1 best response

Accepted Solutions
best response confirmed by Tony2021 (Steel Contributor)
Solution
If InvNo is text, you need to wrap it in single-quotes:
=IIf(DCount("*","Import_Excel_FBL1N","[Reference] ='" & [InvNo] & "'")>0,"Yes","No")

View solution in original post