I'm using Access 2007. I have a fairly simple function (code below) that is meant to get a count of 1 field based on criteria in 2 other fields. It works fine when I copy the sql into a query, but when I run the function it returns 0 as the value. I'm sure there is something simple I'm missing, but I can't figure out what. Any ideas?

Public Function CCDNASub(myMont h As Integer, myYear As Integer) As Integer
Dim mySQL...