I am attempting to piece together my first true VBA project, but I have hit a snag. I have entered the following code into the immediate window:
'msgbox wtCnt' returns a 0, which is what I wanted it to return. 'msgbox sCnt' returns an 8, which is also what I was looking for.
My question is why does 'msgbox suDif' return a null value? Shouldn't it return an 8?
Thanks in advance for any help you can give.
Code:
dim sCnt as Integer
dim wCnt as Integer
dim suDif as Integer
sCnt = DLookup("[Number_of_Su]", "Su_Profile", "[Su_Num] = 9")
wtCnt = IIf(DCount("*", "WorkTable1", "Su_Num = 9") = "", 0, DCount("*", "WorkTable1", "Su_Num = 9"))
suDif = sCnt - wtCnt
msgbox suDif
'msgbox wtCnt' returns a 0, which is what I wanted it to return. 'msgbox sCnt' returns an 8, which is also what I was looking for.
My question is why does 'msgbox suDif' return a null value? Shouldn't it return an 8?

Thanks in advance for any help you can give.