|
-
April 20th, 2001, 09:48 AM
#1
Export Data
I need to export data from an access database as a *.csv. Any ideas?? Is this possable?
-
April 20th, 2001, 11:16 AM
#2
Re: Export Data
For example you want to export Your table to the temp.csv file with "|" as delimeter
create a recordset from your table and then
rs.movefirst
do while not rs.eof
Open "c:\temp.csv" For Output As #1 'to write to
Print #1, rs!Field(1).Value & "|" & rs!Field(2).Value & ...etc
Close #1
rs.movenext
Loop
Iouri Boutchkine
[email protected]
-
April 20th, 2001, 12:59 PM
#3
Re: Export Data
The following code will create a .csv file from an Access 2000 table:
Note this will put double quotes around each field in the .csv file. If you do not want the double quotes then use the export wizard to create a specification by changing the text qualifier to none. Put the specification name just before the table name in the code below.
Dim appAccess as new Access.Application
'***********************************************************************
'************* Open Access database and transfer file to DB ************
'Must select Access 8 Object Library for Access 97 &
'Access 9 Library for Access 2000 in Project|References
'Open Database DB Path Exclusive
appAccess.OpenCurrentDatabase "Path\Some..MDB", true
' Transfer text file to database
appAccess.DoCmd.TransferText acExportDelim,"[Specification Name if required]" , "Tablename", "Path\somefile.csv", 1
' Close
appAccess.CloseCurrentDatabase
' set object to nothing
set appAccess = nothing
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|