27. februar 2008 - 09:39Der er
8 kommentarer og 1 løsning
Adding query results to Excel
Hi
I found out that I needed to add some results from a Query to an Excel spreadsheet. The Pivot Query gives the following result:
January February May June July September October November T Data Data Data Data Data Data Data Data B Data Data Data HERE Data Data Data Data F Data Data Data Data Data Data Data Data
Now I need to take for instance the value for B, June - and get it out so I can add it to a specific Excel cell, and then I need to take T,February and add that to a different Excel Cell. I use this to add to the Excel sheet:
Dim objXL As Excel.Application Dim strMyData As String strMyData = <This is where I need the value> Set objXL = New Excel.Application objXL.Visible = True objXL.Workbooks.Add objXL.Cells(1, 1).Formula = strMyData
But again I don't know how to pull the specific data from the query.
As 'Name' is a reserved Word i Access you should avoid using this as a field name. Try renaming the field in the query. (in a report 'Name' would return the name of the report instead the field 'Name' - maybe this is the case in a Pivot Query as well)
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.