Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

Crosstab SQL How to get the Column Heading Values

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DWDZEB40 - 07 Nov 2006 09:57 GMT
Hi,

I've writen the following SQL in Excel using DAO:

Transform Count(ComplaintNo)
Select LevelOfComplaint
From tblComplaints
Where ResolvedStage <>'Resolved OR ResolvedStage Is Null
Group By LevelOfComplaint
PIVOT DateReceived

I copy the data from a recordset into Excel, the problem is I need to get
the values for DateReceived for the column headings. How do I do this?

Thanks
Allen Browne - 07 Nov 2006 10:02 GMT
You would need to OpenRecordset on a query like this:
   SELECT DISTINCT DateReceived
   FROM tblComplaints
   WHERE (ResolvedStage <>'Resolved')
       OR (ResolvedStage Is Null)
   ORDER BY DateReceived;

Then loop through the records to build the string to use in the PIVOT
clause.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> I've writen the following SQL in Excel using DAO:
>
[quoted text clipped - 9 lines]
>
> Thanks
DWDZEB40 - 07 Nov 2006 10:23 GMT
Thanks Allen.

> You would need to OpenRecordset on a query like this:
>     SELECT DISTINCT DateReceived
[quoted text clipped - 19 lines]
> >
> > Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.