I'm creating a query with a where statement using VBA to create a DAO
recordset. I've separated the query to make it easier to read. This
is the query:
SELECT [test].Race, Count([test].Race) AS CountOfRace
FROM [test]
WHERE ((([test].[Name])='BSS 101/OUT 101')
AND (([test].[Codes])='WORKBOC0104' )
AND (([test].[Completed Training])=True))
OR ((([test].[Name])='BSS 101/OUT 101')
AND (([test].[Codes])='WORKBOC0304' )
AND (([test].[Completed Training])=True))
OR ((([test].[Name])='BSS 101/OUT 101')
AND (([test].[Codes])='WORKPTA0104' )
AND (([test].[Completed Training])=True))
OR ((([test].[Name])='BSS 101/OUT 101')
AND (([test].[Codes])='WORKPTA0304' )
AND (([test].[Completed Training])=True))
OR ((([test].[Name])='Common Cents - Fiscal Controls')
AND (([test].[Codes])='PRCDFIS0104' )
AND (([test].[Completed Training])=True))
GROUP BY [test].Race;
As you can see each where statement uses this same statement:
AND (([test].[Completed Training])=True
My question is there an easier way to create this statement without
having to use "AND (([test].[Completed Training])=True" each time?
Thanks in advance for the help.
recordset. I've separated the query to make it easier to read. This
is the query:
SELECT [test].Race, Count([test].Race) AS CountOfRace
FROM [test]
WHERE ((([test].[Name])='BSS 101/OUT 101')
AND (([test].[Codes])='WORKBOC0104' )
AND (([test].[Completed Training])=True))
OR ((([test].[Name])='BSS 101/OUT 101')
AND (([test].[Codes])='WORKBOC0304' )
AND (([test].[Completed Training])=True))
OR ((([test].[Name])='BSS 101/OUT 101')
AND (([test].[Codes])='WORKPTA0104' )
AND (([test].[Completed Training])=True))
OR ((([test].[Name])='BSS 101/OUT 101')
AND (([test].[Codes])='WORKPTA0304' )
AND (([test].[Completed Training])=True))
OR ((([test].[Name])='Common Cents - Fiscal Controls')
AND (([test].[Codes])='PRCDFIS0104' )
AND (([test].[Completed Training])=True))
GROUP BY [test].Race;
As you can see each where statement uses this same statement:
AND (([test].[Completed Training])=True
My question is there an easier way to create this statement without
having to use "AND (([test].[Completed Training])=True" each time?
Thanks in advance for the help.
Comment