Have you looked at wrapping the entire syntax inside an IIF statement? Like this:
=IIF(len(myvar)=0, 0, DCount(...))
I haven't tested the len() part but there are other ways of testing for Null (if the len method doesn't work) with functions like IsNull or NZ...
Also watch your snytax with the DLookup and DCount functions - the third argument should look like this for a numerical value:
"[StoreID] = " & myvar
or like this for a text value:
"[StoreID] = '" & myvar & "'"
And maybe you want to use a DCount function instead of a DLookup if you want to count the number of records....just a thought....