GoodyGoody
Registered User.
- Local time
- Today, 12:28
- Joined
- Aug 31, 2019
- Messages
- 120
Hi,
I'm running Access 2013 on Windows 10. I have a form with a drop down which selects races that have not been 'finalised' (i.e. the results verified as correct, it doesn't really matter though. The point is that this is a an access database Boolean Yes/No type field with values as I understand of 0-false and -1-true).
The current SQL runs fine and selects only the non-finalised races:
SELECT RN.ID, RN.RaceName, RN.RaceDistance
FROM RaceName AS RN
WHERE (((RN.ID) In (SELECT RE.RaceName FROM RaceEvent AS RE WHERE RE.RaceName = RN.ID and RE.RaceEventClosed=false)))
ORDER BY RN.RaceName;
I now want to add a toggle button on the form so that users can choose which type of race to report on so I've added a toggle button to the form and amended the SQL as follows using the name of the new field on the form. I've used the CInt() function as I believe that the actual form field is a variant type. However, when I run the SQL below it tells me the expression is too complex to evaluate (there are no typos and if I use '0' or '-1' instead it works fine:
SELECT RN.ID, RN.RaceName, RN.RaceDistance
FROM RaceName AS RN
WHERE (((RN.ID) In (SELECT RE.RaceName FROM RaceEvent AS RE WHERE RE.RaceName = RN.ID and RE.RaceEventClosed=CInt([Forms]![frmSelectRace]![togHistReports]))))
ORDER BY RN.RaceName;
Your thoughts please oh access Gods! Many thanks as ever.
Stephen
I'm running Access 2013 on Windows 10. I have a form with a drop down which selects races that have not been 'finalised' (i.e. the results verified as correct, it doesn't really matter though. The point is that this is a an access database Boolean Yes/No type field with values as I understand of 0-false and -1-true).
The current SQL runs fine and selects only the non-finalised races:
SELECT RN.ID, RN.RaceName, RN.RaceDistance
FROM RaceName AS RN
WHERE (((RN.ID) In (SELECT RE.RaceName FROM RaceEvent AS RE WHERE RE.RaceName = RN.ID and RE.RaceEventClosed=false)))
ORDER BY RN.RaceName;
I now want to add a toggle button on the form so that users can choose which type of race to report on so I've added a toggle button to the form and amended the SQL as follows using the name of the new field on the form. I've used the CInt() function as I believe that the actual form field is a variant type. However, when I run the SQL below it tells me the expression is too complex to evaluate (there are no typos and if I use '0' or '-1' instead it works fine:
SELECT RN.ID, RN.RaceName, RN.RaceDistance
FROM RaceName AS RN
WHERE (((RN.ID) In (SELECT RE.RaceName FROM RaceEvent AS RE WHERE RE.RaceName = RN.ID and RE.RaceEventClosed=CInt([Forms]![frmSelectRace]![togHistReports]))))
ORDER BY RN.RaceName;
Your thoughts please oh access Gods! Many thanks as ever.

Stephen