473,421 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,421 software developers and data experts.

Exporting data from Access to CSV in particular format

119 100+
Hi there,

My question does not concern the exporting of data to CSV so much as the format of the exported data. The data to be exported consists of a time series of prices for a number of assets. I can easily bring up a query of the data I want to export in the following way:

Expand|Select|Wrap|Line Numbers
  1. SELECT Date, Asset, AssetPrices
  2. FROM tblPrices;
  3.  
returning:

Expand|Select|Wrap|Line Numbers
  1. [Date],[Asset],[AssetPrice]
  2. date_1,asset_1,price_1    
  3. date_2,asset_1,price_2
  4. date_3,asset_1,price_3
  5. etc....
  6. date_1,asset_2,price_1    
  7. date_2,asset_2,price_2
  8. date_3,asset_2,price_3
  9. etc....
  10. date_1,asset_3,price_1    
  11. date_2,asset_3,price_2
  12. date_3,asset_3,price_3
  13. etc....
  14.  
However, in the CSV format I would like the prices to be aligned in the following way:

Expand|Select|Wrap|Line Numbers
  1. "Date","Asset_1","Asset_2","Asset_3"
  2. date_1,price_1, price_1, price_1
  3. date_2,price_2, price_2, price_2
  4. date_3,price_3, price_3, price_3
  5. etc....
  6.  
So, taking a 1-dimensional data structure within Access and exporting it as a 2-dimensional data structure. Does anyone know how to do this? Two possibilities might be to (1) create a data structure in Access to then export to CSV or (2) export each asset's data series at a time, appending successive columns of data within the CSV file.

Any help greatly appreciated.
May 14 '08 #1
2 1821
nico5038
3,080 Expert 2GB
For this you need a cross table query.
Place the fields like:
Date, Asset, AssetPrices
in the query editor and change the query type to cross-table.
Now change the GroupBy under the AssetPrices into "Max"
Finally set the fields in the "combo line" for the cross table like:
Rowheader, ColumnHeader and Value

Nic;o)
May 14 '08 #2
billelev
119 100+
Perfect! Thanks, Nic.

I've been looking for this kind of formatting in Access (obviously not very hard) for about a year!
May 14 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: sridevi | last post by:
Hello How to export data from ms-access database to excel worksheet using ASP. mainly i need to export data to multiple worksheets. it is very urgent to us. i have a sample code which works...
4
by: D | last post by:
I've created a report with many subreports of aggregate data. I want my client to be able to export this data to Excel to make her charts, etc. Only one problem: one of the fields is a "SchoolYear"...
0
by: Stephan Golux | last post by:
Hello. I am using an access 97 application that exports a report to RTF format, which is subsequently emailed to various people. The main informational field in the report is a free form memo...
5
by: mik18 | last post by:
I'm having trouble with exporting reports to Word in the rtf format and I'm hoping someone has a solution. The reports are losing their formats. Not all the formating is lost but some is and of...
11
by: PC Datasheet | last post by:
AccessXP in 2000 mode. I am running a procedure using Application.ExportXML. The XML file begins with: <?xml version="1.0" encoding="UTF-8" ?> - <dataroot...
1
by: kim | last post by:
Hello! Here, in brief, is my problem. Access 2002. I need to export to a csv text file with text delimiters on every field. I find that if I save the original data in Excel and make sure the...
1
by: Mustufa Baig | last post by:
I have an ASP.NET website where I am showing off crystal reports to users by exporting them to pdf format. Following is the code: ---------------- 1 Private Sub ExportReport() 2 Dim oStream...
6
by: sara | last post by:
I have what I think is a little strange...I have to get data from our payroll system into a specific format (fixed record length) as a .txt or .prn file only to upload to our 401k custodian. I...
0
by: =?Utf-8?B?ZGVuIDIwMDU=?= | last post by:
hi, I trying to export data display on a gridview that supports any language (like chinese, japanese, thai, french) shown here is chinese only. There is no problem exporting english language...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.