Create a cross tab query with SQL

Ben_Entrew

Registered User.
Local time
Today, 13:07
Joined
Dec 3, 2013
Messages
177
Hi all,

I try to create a cross tab query via SQL.
Somehow the below code return me a Run-Time Error '3000'.

Can someone please help me out here?

Thanks in advance.

Regards,
Ben


Code:
Sub TEST2()
Dim strSQL As String

DoCmd.SetWarnings False

strSQL = "TRANSFORM Sum(REALIZED_SALES_QUANTITIES.[Sales_Quantity]) AS SumOfSales_Quantity " & _
         " SELECT REALIZED_SALES_QUANTITIES.[Customer], Sum(REALIZED_SALES_QUANTITIES.[Sales_Quantity]) AS [Total Of Sales_Quantity] INTO TEST222 " & _
         " FROM REALIZED_SALES_QUANTITIES " & _
         " GROUP BY REALIZED_SALES_QUANTITIES.[Customer] " & _
         " PIVOT REALIZED_SALES_QUANTITIES.[Reporting_Month]"

DoCmd.RunSQL strSQL

DoCmd.SetWarnings True

End Sub
 
Do one operation at a time, INTO creates a New table/Appends to an existing table, once that is done, do the CROSS TAB. Do not club them together.
 
Thanks Paul,

without your help I wouldn't know how to survive here.
Thank you again.

Regards,
Ben
 

Users who are viewing this thread

Back
Top Bottom