WIAEnrollmentsDetailQ1 is a select query, which contains a calculated String field named GrantGrp. The query works as intended as the RecordSource for several detail reports, and when opened directly from the user interface. It is also the RecordSource for a summary report, which is intended to provide a count of the number of records for each value of GrantGrp. In the summary report's GrantGrp footer, there is a control named txtGrantGrp (bound to GrantGrp) and another control named txtGroupCount (bound to the expression =DCount("sSSN","WIAEnrollmentsDetailQ1","GrantGrp = '" & [txtGrantGrp] & "'"). txtGroupCount always displays "#Error". When I use the same DCount function in a Sub (after first DIMming txtGrantGrp as String and assigning an appropriate value to it), it generates the error "Data type mismatch in criteria expression."
I've used DCount like this for years without any problem, and am totally stumped about what the problem is. Any help will be greatly appreciated.
I've used DCount like this for years without any problem, and am totally stumped about what the problem is. Any help will be greatly appreciated.