J
James Allen
I have a SQL string that is written in VBA, and is too
comlex to create in the Access QBE.
However, the problem is that when my query is passed into
Access to execute it groups the criteria in the WHERE
clause with parenthesis and accordingly the query does not
work right.
Example:
My SQL string is:
SELECT DISTINCT StudentDownload.ID,
StudentDownload.Name, StudentDownload.AmountAwarded,
Criteria.SchDesignation, StudentDownload.Major,
StudentDownload.GPA,5800 AS SpenAmount INTO tblResults
FROM StudentDownload, Criteria WHERE
Criteria.SchDesignation ="BOSWE" AND
StudentDownload.AmountAwarded <= 5800 AND
StudentDownload.Major Like "*" & "Business" OR
StudentDownload.Major Like "*" & "Accounting" OR
StudentDownload.Major Like "*" & "Finance" OR
StudentDownload.Major Like "*" & "Marketing" OR
StudentDownload.Major Like "*" & "Management" OR
StudentDownload.Major Like "*" & "Electronic Business"
Access does this in in the SQL design view:
SELECT DISTINCT StudentDownload.ID, StudentDownload.Name,
StudentDownload.AmountAwarded, Criteria.SchDesignation,
StudentDownload.Major, StudentDownload.GPA, 5800 AS
SpenAmount INTO tblResults
FROM StudentDownload, Criteria
WHERE (((Criteria.SchDesignation)="BOSWE") AND
((StudentDownload.AmountAwarded)<=5800) AND
((StudentDownload.Major) Like "*" & "Business")) OR
(((StudentDownload.Major) Like "*" & "Accounting")) OR
(((StudentDownload.Major) Like "*" & "Finance")) OR
(((StudentDownload.Major) Like "*" & "Marketing")) OR
(((StudentDownload.Major) Like "*" & "Management")) OR
(((StudentDownload.Major) Like "*" & "Electronic
Business"));
In the query design view Access places each criteria
vertically , I need the criteria to remain in one field in
the design view for this work.
How can I prevent Access from grouping my criteria the way
it wants to?
This is a problem because this is not the query that I
need, it does not return the correct results.
James
comlex to create in the Access QBE.
However, the problem is that when my query is passed into
Access to execute it groups the criteria in the WHERE
clause with parenthesis and accordingly the query does not
work right.
Example:
My SQL string is:
SELECT DISTINCT StudentDownload.ID,
StudentDownload.Name, StudentDownload.AmountAwarded,
Criteria.SchDesignation, StudentDownload.Major,
StudentDownload.GPA,5800 AS SpenAmount INTO tblResults
FROM StudentDownload, Criteria WHERE
Criteria.SchDesignation ="BOSWE" AND
StudentDownload.AmountAwarded <= 5800 AND
StudentDownload.Major Like "*" & "Business" OR
StudentDownload.Major Like "*" & "Accounting" OR
StudentDownload.Major Like "*" & "Finance" OR
StudentDownload.Major Like "*" & "Marketing" OR
StudentDownload.Major Like "*" & "Management" OR
StudentDownload.Major Like "*" & "Electronic Business"
Access does this in in the SQL design view:
SELECT DISTINCT StudentDownload.ID, StudentDownload.Name,
StudentDownload.AmountAwarded, Criteria.SchDesignation,
StudentDownload.Major, StudentDownload.GPA, 5800 AS
SpenAmount INTO tblResults
FROM StudentDownload, Criteria
WHERE (((Criteria.SchDesignation)="BOSWE") AND
((StudentDownload.AmountAwarded)<=5800) AND
((StudentDownload.Major) Like "*" & "Business")) OR
(((StudentDownload.Major) Like "*" & "Accounting")) OR
(((StudentDownload.Major) Like "*" & "Finance")) OR
(((StudentDownload.Major) Like "*" & "Marketing")) OR
(((StudentDownload.Major) Like "*" & "Management")) OR
(((StudentDownload.Major) Like "*" & "Electronic
Business"));
In the query design view Access places each criteria
vertically , I need the criteria to remain in one field in
the design view for this work.
How can I prevent Access from grouping my criteria the way
it wants to?
This is a problem because this is not the query that I
need, it does not return the correct results.
James