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!

Why is the cross tab query results displayed? 1

Status
Not open for further replies.

robojeff

Technical User
Joined
Dec 5, 2008
Messages
220
Location
US
I have 2 queries that are very similar but one displays it's contents when it is run by a DoCmd.OpenQuery command and the other does not.

I would like to ensure that neither query does not display its results during run time.. How can I set the query that displays not to?

This query displays its results when the following command is run:

strQuery = "problems_Crosstab"
DoCmd.OpenQuery strQuery, acViewNormal, acReadOnly

PARAMETERS [forms]![report]![StartDate] DateTime, [forms]![report]![EndDate] DateTime, [Forms]![report]![team] Text ( 255 );
TRANSFORM CDbl(NZ(Count([codes].[Problem]))) AS [Problems Found]
SELECT [codes].[Problem]
FROM ([FPY Table] LEFT JOIN [codes] ON [FPY Table].PC1 = [codes].[Problem]) LEFT JOIN [team_tbl] ON ([FPY Table].[Assembly Number] = [team_tbl].[Part Number]) AND ([FPY Table].[Part Number] = [team_tbl].[Part Number])
WHERE ((([FPY Table].[Fail Quantity])=1) AND (([FPY Table].Date) Between [forms]![report]![StartDate] And [forms]![report]![EndDate]) AND (([team_tbl].[Nteam])=[Forms]![report]![team]))
GROUP BY [codes].[Problem], [codes].PCID, [team_tbl].[Nteam]
ORDER BY [codes].PCID
PIVOT Format([Date],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");

----------------

This query does not display its results when the following command is run:

strQuery = "parts_Crosstab"
DoCmd.OpenQuery strQuery, acViewNormal, acReadOnly
PARAMETERS [forms]![reports]![StartDate] DateTime, [forms]![reports]![EndDate] DateTime, [Forms]![reports]![team] Text ( 255 );
TRANSFORM CDbl(NZ(Count([team_tbl].[Part Number]))) AS [CountOfPart Number]
SELECT [FPY Table].[Part Number], BP.IDESC AS [Desc]
FROM [FPY Table] LEFT JOIN ([team_tbl] LEFT JOIN BP ON [team_tbl].[Part Number] = BPC) ON ([FPY Table].[Part Number] = [team_tbl].[Part Number]) AND ([FPY Table].[Assembly Number] = [team_tbl].[Part Number])
WHERE ((([FPY Table].[Fail Quantity])=1) AND (([FPY Table].Date) Between [forms]![reports]![StartDate] And [forms]![reports]![EndDate]) AND (([team_tbl].[Nteam])=[Forms]![reports]![team]))
GROUP BY [FPY Table].[Part Number], BP.IDESC
ORDER BY [FPY Table].[Part Number]
PIVOT Format([Date],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
 
Why use the OpenQuery method if you don't want to see the crosstab ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
You are absolutely right... I missed that one with the first query and that is why it did not display...

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top