7

I have a MS Access mdb file. I need to convert it to a CSV file. How do i do it? Please do not point me to any freeware.

Thanks in advance

Fionnuala
  • 90,370
  • 7
  • 114
  • 152
Rajdeep
  • 485
  • 4
  • 15
  • 28

5 Answers5

6

Another useful tool is mdbtools:

http://mdbtools.sourceforge.net/

oz123
  • 27,559
  • 27
  • 125
  • 187
4

Plotly (https://plot.ly) will convert your MDB files to CSV for free.
EDIT: free Plotly users cannot use this functionality; a subscription is required.

albert
  • 8,112
  • 3
  • 47
  • 63
freemdb
  • 66
  • 2
4

Being no freeware, as you requested, I could recommend you Spectral Core's Full Convert Enterprise.

I've used it successfully in the past, too.

Update:

Since you clarified that you need a programmatic solution, I do recommend you do it manually:

  1. Open a connection to the MDB file through ADO.NET.
  2. Iterate all tables.
  3. Create a text file (CSV) for each table.
  4. For each table, iterate all rows.
  5. For each row, write a new line in the text file.
  6. For each row, iterate all columns.
  7. For each column, write the value to the text file in the current row.
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
  • @Keim ... I meant is that I want Code which will do the conversion. I do not need any tool to do that. Can any one help me with that? – Rajdeep Jun 02 '11 at 07:48
  • Thankx Keim...I did it. But Now I am stuck in a whole new situation.. Now i have to read from that CSV file and convert it in to a MDB file. Any help regarding this? – Rajdeep Jun 03 '11 at 06:19
  • @Rajdeep Try posting a new question and/or searching the Internet for a solution. – Uwe Keim Jun 03 '11 at 06:20
  • @Keim. I didnt get your point. – Rajdeep Jun 03 '11 at 06:24
4

use this utility its opensource and free mdb to csv convertor: MDBtoCSV

Duke
  • 1,731
  • 2
  • 17
  • 33
3

With VBA

Dim db As DAO.Database
Dim tdf As TableDef

Set db = CurrentDb

For Each tdf In db.TableDefs
    If Left(tdf.Name, 4) <> "MSys" Then
        DoCmd.TransferText acExportDelim, , tdf.Name, tdf.Name & ".csv"
    End If
Next

-- http://msdn.microsoft.com/en-us/library/aa220768%28v=office.11%29.aspx

Fionnuala
  • 90,370
  • 7
  • 114
  • 152
  • +1 Actually I prefer my version, but admit that I'm biased. :-) However I still think it's useful to skip dumping "~" tables to CSV, and to include field names in the CSV files. – HansUp Sep 30 '11 at 16:47
  • @HansUp This is an antique question with a throw away answer :) I do not have any "~" tables, I never have had. Do you mean queries? – Fionnuala Sep 30 '11 at 17:48
  • No, I meant tables. When you delete a table, it persists in the TableDefs collection with its original name prefaced by "~". I'm unsure how long they persist in that fashion; compact seems to remove them. But I reckoned, if there is a deleted table still present in TableDefs, there wouldn't be value in saving it as CSV. – HansUp Sep 30 '11 at 18:44
  • Interesting. They do not last past a close and reopen, so they must be tables very recently deleted. – Fionnuala Sep 30 '11 at 18:58