473,320 Members | 1,914 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,320 software developers and data experts.

How to export from Access to CSV?

I'd like to see pseudo code (or actual example is better) explaining how to
export data from an MS Access table to a CSV file.

Thanks,
Brett
Nov 21 '05 #1
8 4780
read the data into a dataset or datareader and write the data out to a file

something like this (written from scratch)

dim writerCSV as new Streamwriter("c:\output.csv")
for i as integer = 0 to dataset.tables(0).rows.count-1
writerCSV.writeline("whatyou" & "," & "want" & "," & "to write")
next
writerCSV.close

be careful with errors on null values

hth Peter

"Brett" <no@spam.com> wrote in message
news:OF**************@TK2MSFTNGP09.phx.gbl...
I'd like to see pseudo code (or actual example is better) explaining how to export data from an MS Access table to a CSV file.

Thanks,
Brett

Nov 21 '05 #2
"Brett" <no@spam.com> schrieb:
I'd like to see pseudo code (or actual example is better) explaining how
to export data from an MS Access table to a CSV file.


<URL:http://groups.google.de/groups?q=acExportDelim>
<URL:http://www.tek-tips.com/viewthread.cfm?qid=972230&page=9>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
("whatyou" & "," & "want" & "," & "to write") are column inside of the
table? Why isn't there any dot notation on them that points to the
datareader? Such as

datareaderVar.Item("column1")

or was that just for the psuedo code?

Thanks,
Brett

"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:O0**************@TK2MSFTNGP14.phx.gbl...
read the data into a dataset or datareader and write the data out to a
file

something like this (written from scratch)

dim writerCSV as new Streamwriter("c:\output.csv")
for i as integer = 0 to dataset.tables(0).rows.count-1
writerCSV.writeline("whatyou" & "," & "want" & "," & "to write")
next
writerCSV.close

be careful with errors on null values

hth Peter

"Brett" <no@spam.com> wrote in message
news:OF**************@TK2MSFTNGP09.phx.gbl...
I'd like to see pseudo code (or actual example is better) explaining how

to
export data from an MS Access table to a CSV file.

Thanks,
Brett


Nov 21 '05 #4
On Wed, 2 Feb 2005 10:14:27 -0500, "Brett" <no@spam.com> wrote:

¤ I'd like to see pseudo code (or actual example is better) explaining how to
¤ export data from an MS Access table to a CSV file.

The following will export with the column names in the first row of the CSV file:

Function ExportAccessToText() As Boolean

Dim AccessConn As New System.Data.OleDb.OleDbConnection("Provider=Micros oft.Jet.OLEDB.4.0;"
& _
"Data Source=e:\My Documents\db1.mdb")

AccessConn.Open()

Dim AccessCommand As New System.Data.OleDb.OleDbCommand("SELECT * INTO [Text;DATABASE=e:\My
Documents\TextFiles].[Table3.csv] FROM Table_3", AccessConn)

AccessCommand.ExecuteNonQuery()
AccessConn.Close()

End Function
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #5
Hi Herfried,

just the say the second link does work, but 2 minutes a go it didn't, I
think it's time for me to go home ;-)

greetz Peter

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uM**************@TK2MSFTNGP09.phx.gbl...
"Brett" <no@spam.com> schrieb:
I'd like to see pseudo code (or actual example is better) explaining how
to export data from an MS Access table to a CSV file.


<URL:http://groups.google.de/groups?q=acExportDelim>
<URL:http://www.tek-tips.com/viewthread.cfm?qid=972230&page=9>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #6
Hi Herfried

I didn't know of the acExportDelim, so I just keep learning every day

thnx,

greetz Peter

PS the second link you sent didn't work

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uM**************@TK2MSFTNGP09.phx.gbl...
"Brett" <no@spam.com> schrieb:
I'd like to see pseudo code (or actual example is better) explaining how
to export data from an MS Access table to a CSV file.


<URL:http://groups.google.de/groups?q=acExportDelim>
<URL:http://www.tek-tips.com/viewthread.cfm?qid=972230&page=9>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #7
Hi Brett,

that was just pseudo code, but look at the link Herfried sent or the code
Paul sent I think those are easier solutions then writing it out yourself.

Greetz Peter
"Brett" <no@spam.com> wrote in message
news:Op**************@TK2MSFTNGP09.phx.gbl...
("whatyou" & "," & "want" & "," & "to write") are column inside of the
table? Why isn't there any dot notation on them that points to the
datareader? Such as

datareaderVar.Item("column1")

or was that just for the psuedo code?

Thanks,
Brett

"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:O0**************@TK2MSFTNGP14.phx.gbl...
read the data into a dataset or datareader and write the data out to a
file

something like this (written from scratch)

dim writerCSV as new Streamwriter("c:\output.csv")
for i as integer = 0 to dataset.tables(0).rows.count-1
writerCSV.writeline("whatyou" & "," & "want" & "," & "to write")
next
writerCSV.close

be careful with errors on null values

hth Peter

"Brett" <no@spam.com> wrote in message
news:OF**************@TK2MSFTNGP09.phx.gbl...
I'd like to see pseudo code (or actual example is better) explaining
how to
export data from an MS Access table to a CSV file.

Thanks,
Brett



Nov 21 '05 #8
Peter,

"Peter Proost" <pp*****@nospam.hotmail.com> schrieb:
PS the second link you sent didn't work


It takes a bit until the page loads.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Tim Eliot | last post by:
Just wondering if anyone has hit the following issue and how you might have sorted it out. I am using the command: DoCmd.TransferText acExportMerge, , stDataSource, stFileName, True after...
2
by: Blake Patterson | last post by:
I have a .vbs script that I'm running from the Windows destkop (intend to have it run by Windows' task scheduler) to pull an export from MS Access. Here's the script: '...
16
by: David Lauberts | last post by:
Hi Wonder if someone has some words of wisdom. I have a access 2002 form that contains 2 graph objects that overlay each other and would like to export them as a JPEG to use in a presentation....
7
by: Pat | last post by:
I would like to send the Print Preview of a MS Access form to a Snapshot file. The form contains an OLE graph. BACKGROUND A snapshot of a report is possible. If I could I would use a report to...
4
by: JJ | last post by:
Hi, usually, I'm not using MS servers, but I have a big problem with a Access table. I should create a web application for a Historical Dipartment. They have created a populated a Access...
1
by: bburton | last post by:
I'm using a form in Access which was used as a bug tracker. The users could update the record with an attachment. (The data type of the field that is used for attachments is the OLE Object) I...
14
by: bonehead | last post by:
Greetings, I'm using the DoCmd.TransferText method to export the results of a MS Access query to a csv file. The csv will then be used to load an Oracle table. In other systems such as TOAD...
3
by: hbarnett | last post by:
I am in process of converting Access 97 databases to Access 2003. Some of the Access 97 databases export data to a text file with a non standard file extension, such as "ext" or "NAL". When I try...
1
by: smaczylo | last post by:
Hello, I've recently been asked to work with Microsoft Access, and while I feel quite comfortable with Excel, I'm at a complete loss with databases. If someone could help me with this issue I'm...
8
by: iheartvba | last post by:
Hi I am using Access 2007 and am trying to export a query to a fixed length text file. I tried using the following code to export the text file: DoCmd.TransferText acExportFixed, , "qryFFRDeFile",...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.