SQL

Benno2805

New Member
Joined
Jul 1, 2003
Messages
19
I have created the following query in Access and pasted the SQL into VBA to run in Excel.
I've done this many times before, but this time it's a crosstab query and it doesn't like the TRANSFORM...any ideas?


ComplaintsSQL = "TRANSFORM Count(dbo_tbl_complaint_type.description) AS CountOfdescription" & _
"SELECT dbo_tbl_complaint_type.description" & _
"FROM (dbo_tbl_contact_reason INNER JOIN dbo_tbl_customer ON dbo_tbl_contact_reason.contact_reason_id = dbo_tbl_customer.contact_reason_id) INNER JOIN dbo_tbl_complaint_type ON dbo_tbl_customer.complaint_type_id = dbo_tbl_complaint_type.complaint_type_id" & _
"WHERE (((dbo_tbl_customer.date_created) >= #8/1/2003# And (dbo_tbl_customer.date_created) <= #10/31/2003#))" & _
"GROUP BY dbo_tbl_complaint_type.description" & _
"ORDER BY dbo_tbl_complaint_type.description, Format([dbo_tbl_customer].[date_created],'mm')" & _
"PIVOT Format([dbo_tbl_customer].[date_created],'mm');"




thanks in advance.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
I had the same problem once and it looks like with TRANSFORM syntax you have to make sure you have row breaks (chr(10)) after every SQL command. So try:

"SELECT dbo_tbl_complaint_type.description" & Chr(10) & _
"FROM ................................................... & Chr(10) & _
etc

HTH
 
Upvote 0

Forum statistics

Threads
1,223,920
Messages
6,175,377
Members
452,638
Latest member
Oluwabukunmi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top