I am attempting to use the DCount() Function to return a count from my table. My issue is that it always returns a NULL value.
How should I Re-write this VBA statement so that it returns the accurate count?
ReturnedCount = DCount("CountOfItems", "[__TestTable]", "NameOfItem = " & ItemName)
Debug.Print ReturnedCount
NameOfItem
implies a string. You need to wrap strings in single quotes when passing them as a parameter to a D-Function; just like passing them as a parameter in a Query.
ReturnedCount = DCount("CountOfItems", "[__TestTable]", "NameOfItem = '" & ItemName & "'")
Using the immediate window to test your D-Functions will simplify debugging.