Hello to all,
I'm working with SQL in Access VBA code behind a form. And I'm not an expert in SQL or Access, so please bear with me.
I have a query that gives me an ID (Dnumber), a test type (TestDesc) and several aggregate functions based on raw data stored in a table. The query (from the query view, not VBA) is as follows;
This works. I am currently using a form with a multi-select list box to allow the user to select test type ("LENGTH", above) and 2 text boxes for a low and high search range (3 and 6, above). But what I'd like to do is be able to choose two or more test types and enter different search ranges for each. From searching the Internet it seems that an SQL INTERSECT query might do the trick. However, I also found out that Access does not allow the INTERSECT keyword, but uses joins to simulate an intersection. But I can't seem to find the correct SQL syntax to accomplish this in Access VBA.
I have tried working around this using what I know. I've tried using the UNION keyword and filtering those results. The UNION keyword works fine but I then have trouble filtering the results in VBA code.
Could someone please point me in the right direction? Any assistance will be greatly appreciated.
Thanks in advance,
Jackie
I'm working with SQL in Access VBA code behind a form. And I'm not an expert in SQL or Access, so please bear with me.
I have a query that gives me an ID (Dnumber), a test type (TestDesc) and several aggregate functions based on raw data stored in a table. The query (from the query view, not VBA) is as follows;
Code:
SELECT TestData.Dnumber, TestCode.TestDesc, Avg(TestData.Data) AS Average, Min(TestData.Data) AS [Min], Max(TestData.Data) AS [Max] FROM TestCode INNER JOIN TestData ON TestCode.TestCode = TestData.TestCode GROUP BY TestData.Dnumber, TestCode.TestDesc HAVING (((TestCode.TestDesc) Like "LENGTH") AND ((Avg(TestData.Data)) Between 3 And 6));
I have tried working around this using what I know. I've tried using the UNION keyword and filtering those results. The UNION keyword works fine but I then have trouble filtering the results in VBA code.
Could someone please point me in the right direction? Any assistance will be greatly appreciated.
Thanks in advance,
Jackie