Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 241
  • Last Modified:

Export csv file format - Access 2002

I am trying to export an Access 2002 db table in a csv format

I want it to look like this when exported

"field1","field2","field3","field4"

instead I am getting this if i put a txt extension but I want a csv
"field1        ","field2         ","field3","field4       ","  

and if i put the csv extention i get each field in a separate excel cell across
0
Pdeters
Asked:
Pdeters
  • 8
  • 8
1 Solution
 
Rey Obrero (Capricorn1)Commented:
you have to use

docmd.transfertext acexportdelim, "importspecificationName", "tableName", "c:\myText.csv", true
0
 
PdetersAuthor Commented:
where do i put this
Riht now i have the export in a macro
0
 
Rey Obrero (Capricorn1)Commented:
create a new macro, using TransferText and fill out all the necessary info
you will need a new export specification


Action
TransferText


Transfer Type           Export Delimited
Specification Name



0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
PdetersAuthor Commented:
Ok - but where do I put this?
docmd.transfertext acexportdelim, "importspecificationName", "tableName", "c:\myText.csv", true
0
 
Rey Obrero (Capricorn1)Commented:
what do you want a macro or vba solution?

this is vba
docmd.transfertext acexportdelim, "importspecificationName", "tableName", "c:\myText.csv", true
0
 
PdetersAuthor Commented:
either
 just so it turns out corectly

Right now I have the macro
as

Action
TransferText
Transfer Type           Export Delimited
Specification Name

In the Specificiation i have it set up as
Delimited
field Delimiter ,
text qualifieer "

and i get
"field1        ","field2         ","field3","field4       ","  

this is what I want

"field1","field2","field3","field4"
0
 
Rey Obrero (Capricorn1)Commented:
your export spec is telling the export to have a fixed width.


can you attach your db?
0
 
PdetersAuthor Commented:
I checked and and redid the specs - still doing -  i belive it is set to delimited
0
 
Rey Obrero (Capricorn1)Commented:
run this update query

update tableName set  field1=trim([field1]), field2=trim([field2]),field3=trim([field3]),field4=trim([field4])


then try the export
0
 
PdetersAuthor Commented:
forgot to attached here it is
Reports.mdb
0
 
Rey Obrero (Capricorn1)Commented:
this is what i got after running the  macro


Export.csv.txt
0
 
PdetersAuthor Commented:
I don't? could it be 2002 versus 2003 version of access?
Is it common to have csv.txt after then end to make it work?
0
 
Rey Obrero (Capricorn1)Commented:
for uploading file to this site >> .csv is not supported
i created the file export.csv directly i just added the .txt to the file name so i can attach the file here.
0
 
PdetersAuthor Commented:
when i open as a csv i get an excel spreadsheet with each in a different cell. I need this
"field1","field2","field3","field4"

is this possbile.
0
 
Rey Obrero (Capricorn1)Commented:
then do not use a .csv as output format,
use .txt
0
 
PdetersAuthor Commented:
I will do that. Sometimes I make things way too difficult.

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 8
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now