I have two functions Function1 and Function2 that basically do the same thing: select a group of records from a table based on two fields, analyze them to see if as a group they meet a certain standard, and return the result as a string, basically "Yes" or "". The two functions analyze the data differently - I discovered a case where Function1 could return an incorrect result under certain conditions, so I refined the logic and wrote Function2. So far so good.
I have a summary query Query1 from the same table; it groups on one field ([TripID]), finds the min and max of dates corresponding to that TripID, totals the Miles for the TripID, and calls the two functions noted above, such that Field1 = Function1([TripID]) and Field2 = Function2([TripID]). The values in Field1 and Field2 are "" or "" as noted above. Still so far so good - results are as expected.
Next I have another query Query2 based on the Query1 that selects only the records where Field1 = "Yes". That works perfectly. But when I instead try to select the records where Field2 = "Yes", I get Data Type Mismatch in Criteria Expression. If I eliminate the criteria, Query2 runs fine (it looks just like Query1).
So I'm baffled why one works and one does not. I cannot find any differences in data type, and I have tried changing field names and string results to avoid anything that might be confusing.
Any suggestions?