Access 2003 – command button to show query in pivot format

5 pts.
Tags:
Data Tables
Microsoft Access 2003
Microsoft Access queries
Pivot tables
VB Code
Visual Basic
I have a form with a comman button.  I want the user to be brought to a query when they press the button.  The query is built in a pivot table format, but when accessed by the command button, it appears as a datatable instead.  What am I doing wrong?

Software/Hardware used:
Office 2003

Answer Wiki

Thanks. We'll let you know when a new response is added.

Here is an example using a command button on an Access2003 form

PART CODE BASEPRICE

ABRA OLD $250.00
CA MID $2.50
CA NEW $2.00
DA MID $200.00
BRA NEW $250.00

TRANSFORM Sum(tbl3Cols.BasePrice) AS SumOfBasePrice
SELECT tbl3Cols.Code, Sum(tbl3Cols.BasePrice) AS [Total Of BasePrice]
FROM tbl3Cols
GROUP BY tbl3Cols.Code
PIVOT tbl3Cols.Part;

RETURNS

CODE Total Of BasePrice ABRA BRA CA DA

MID 202.5 2.5 200
NEW 252 250 2
OLD 250 250

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim stDocName As String

stDocName = “tbl3Cols_Crosstab”
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following