I have a select statement that returns the right record when it runs in the Access query wizard, but returns too many records when run in VBA code.
This is the query:
Select * From Data_detail Where ( Procedure = 'T1004') AND (Charges = 139.5) AND (cdate(To_Date) = '8/10/2009') AND (parent_ID = 27098)
It picks up all of the detail records linked to the parent_id, ignoring the other requirements. If I add DISTINCT to it, then it runs correctly - but I can't edit that recordset and I need to be able to.
But if I copy this code into the query wizard, it runs correctly, pulling up just one record.
The problem shows up in Access 2003, developer version and in the runtime.

This is the query:
Select * From Data_detail Where ( Procedure = 'T1004') AND (Charges = 139.5) AND (cdate(To_Date) = '8/10/2009') AND (parent_ID = 27098)
It picks up all of the detail records linked to the parent_id, ignoring the other requirements. If I add DISTINCT to it, then it runs correctly - but I can't edit that recordset and I need to be able to.
But if I copy this code into the query wizard, it runs correctly, pulling up just one record.
The problem shows up in Access 2003, developer version and in the runtime.