Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid Bracketing Problem

Status
Not open for further replies.

Dave177

Programmer
Joined
Jan 9, 2005
Messages
165
Location
GB
Hello,

I have a query as follows:
Code:
SELECT qryRegMonFigsByEstabWorkshop.EstabCode, qryRegMonFigsByEstabWorkshop.Industry, Sum(qryRegMonFigsByEstabWorkshop.PlannedP2PlacesPred) AS SumOfPlannedP2PlacesPred, Sum(qryRegMonFigsByEstabWorkshop.AvgOfP2sActual) AS SumOfAvgOfP2sActual, Sum(qryRegMonFigsByEstabWorkshop.AvgOfAttendanceActual) AS SumOfAvgOfAttendanceActual
FROM qryRegMonFigsByEstabWorkshop
GROUP BY qryRegMonFigsByEstabWorkshop.EstabCode, qryRegMonFigsByEstabWorkshop.Industry
HAVING (((qryRegMonFigsByEstabWorkshop.EstabCode)=[Reports]![rptYasmine3]![tblACF.Establishment]));
I created it in the design grid and it works fine until I add the criteria as described after "HAVING" in the SQL statement (the query will be the source of a subreport linked by the field [tblACF.Establishment] in the main report). It then gives me an invalid bracketing error.

Any help would be greatly appreciated.

David
 
Sarting with ((( and ending in )) makes one set redundant. Although it shouldn't make any difference try:

HAVING ([red]([/red](qryRegMonFigsByEstabWorkshop.EstabCode)=[Reports]![rptYasmine3]![tblACF.Establishment]));

->

HAVING ((qryRegMonFigsByEstabWorkshop.EstabCode)=[red]([/red][Reports]![rptYasmine3]![tblACF.Establishment]));

 
I would imagine the problem is here:

[tblACF.Establishment]

In that it is invalidly bracketed. Try:

[Establishment]

As an aside, I suggest you use an alias. Your query name is very long:

Code:
SELECT q.EstabCode, q.Industry, Sum(q.PlannedP2PlacesPred) AS SumOfPlannedP2PlacesPred, 
Sum(q.AvgOfP2sActual) AS SumOfAvgOfP2sActual, 
Sum(q.AvgOfAttendanceActual) AS SumOfAvgOfAttendanceActual
FROM qryRegMonFigsByEstabWorkshop q
GROUP BY q.EstabCode, q.Industry
HAVING q.EstabCode=Reports!rptYasmine3!tblACF.Establishment

This is the alias: qryRegMonFigsByEstabWorkshop q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top