Forum Discussion
Destiny_Kelley
May 22, 2023Copper Contributor
Query MS Access Database Table with Multiple Column Values Represented by Multiple Rows
I have created a MS Access database for filtering documents that meet certain criteria. Most documents have multiple criteria, so I added multiple rows for the same document for each different criter...
Tom_van_Stiphout
May 22, 2023Iron Contributor
Be careful: Document1.Logic has a mix of AND and OR. According to the precedence rules, AND is evaluated before OR. When in doubt, use parentheses.
The general pattern is:
select * from myDocuments
where Criteria = Forms!myCriteriaForm!myCriteriaControlName1
or Criteria = Forms!myCriteriaForm!myCriteriaControlName2
I don't know how to do this in pure SQL. It would probably be very contorted, if at all possible, and that would defeat the purpose of a simple way to check that the VBA logic is correct.
Maybe better to setup certain test scenarios so you can convince yourself of the correctness.
The general pattern is:
select * from myDocuments
where Criteria = Forms!myCriteriaForm!myCriteriaControlName1
or Criteria = Forms!myCriteriaForm!myCriteriaControlName2
I don't know how to do this in pure SQL. It would probably be very contorted, if at all possible, and that would defeat the purpose of a simple way to check that the VBA logic is correct.
Maybe better to setup certain test scenarios so you can convince yourself of the correctness.