I was playing with some code and I tried to use variables in the DSum() function...I managed to get the expression and the domain to work, but for the life of me I can't get the critera to understand the variable.
Dim tce, aNme, nmi, cn, c3
cN = "f3"
tce = "table1"
aNme = Array("[f3]"
nmi = aNme(0)
If IsNull(DSum("[f3]", "table1", "[f3] = 3") = True Then
MsgBox "empty"
Else:
---->>> cn = DSum([nmi], [tce], "cN = 1"<<<---
End If
In this code the first DSum works...(no variables)
The second uses 3 variables, nmi, tce and cN. nmi and tce are recognized and work. cN returns everything except what the function wants. I tried (cN) [cN] "cN" 'cN' all with and without the '=1' after.
I'm beginning to think that VB access will not allow a variable here no matter what.
Dim tce, aNme, nmi, cn, c3
cN = "f3"
tce = "table1"
aNme = Array("[f3]"
nmi = aNme(0)
If IsNull(DSum("[f3]", "table1", "[f3] = 3") = True Then
MsgBox "empty"
Else:
---->>> cn = DSum([nmi], [tce], "cN = 1"<<<---
End If
In this code the first DSum works...(no variables)
The second uses 3 variables, nmi, tce and cN. nmi and tce are recognized and work. cN returns everything except what the function wants. I tried (cN) [cN] "cN" 'cN' all with and without the '=1' after.
I'm beginning to think that VB access will not allow a variable here no matter what.