I am using Dcount to count the number of empty (null) rows in various fields in a couple of different tables and in two different forms.
The syntax is identical for both forms, apart from field and table names. In one form Dcount returns the correct number in the other it returns 0 in every case.
All of the fields in question are Null. None have any characters, including " ". Where am I going wrong?
The code is in the "Form_Load()" event in both cases.
This code returns the correct count.
All fields are Text
This code returns 0
Genus and SpeciesEpithet fields are Text. BoxNo field is Integer.
The xCount variables have not been defined in either sub or as publics
Can the last two lines of the second snippet be written in one line as "[BoxNo] = 0 or [BoxNo] = 999"
The syntax is identical for both forms, apart from field and table names. In one form Dcount returns the correct number in the other it returns 0 in every case.
All of the fields in question are Null. None have any characters, including " ". Where am I going wrong?
The code is in the "Form_Load()" event in both cases.
This code returns the correct count.
All fields are Text
Code:
fCount = DCount("[CombFamily]", "Fam-Gen-Comp", "[combfamily] = ''")
gCount = DCount("[Comb-Genus]", "Fam-Gen-Comp", "[Comb-Genus] = ''")
sCount = DCount("[Comb-Species]", "Species_Comp", "[Comb-Species] = ''")
nCount = DCount("*", "Name Changes")
Do stuff depending on counts
This code returns 0
Genus and SpeciesEpithet fields are Text. BoxNo field is Integer.
Code:
gCount = DCount("[Genus]", "Main", "[Genus] = ''")
eCount = DCount("[SpeciesEpithet]", "Main", "[SpeciesEpithet] = ' '")
bCount = DCount("[BoxNo]", "Main", "[BoxNo] = 0")
bCount = bCount + DCount("[BoxNo]", "Main", "[BoxNo] = 999")
Do stuff depending on counts
The xCount variables have not been defined in either sub or as publics
Can the last two lines of the second snippet be written in one line as "[BoxNo] = 0 or [BoxNo] = 999"