[AccessD] (OT) saving as *cvs with " "

Stuart McLachlan stuart at lexacorp.com.pg
Thu Jan 15 16:15:40 CST 2004


On 15 Jan 2004 at 15:15, Oleg_123 at xuppa.com wrote:

> Hey Group
> i have to save this data (right now I have it in a spreadsheet)
> 01003, 011-11-1123, Doe, Jane, A
> 
> as .txt file so it would like
> 
> 01003, 011-11-1123, "Doe", "Jane", A
> 
> 
> and they specifically want quotes around first and last name, and ONLY
> there. when I create *.csv file from Excel I got no quotations (I tried
> specifically making those 2 fields as "text" and the others as "general"
> and even "numbers", but no result) When I do it through though Acess I get
> all in quotations, and over there I can't play with data types. I tried
> adding colums with " at the beginning and end of mane fields, but ehen I
> converted that to *.csv I got tripe quotes on names, and no quotes
> elsewhere...
> Any suggestions ?
> 

Do it yourself rather than trying to use automated routines.
With  the data as an Access table (myData), run a function like.

Function ExportData() as Long
Dim strExport as String
Dim rs as Recordset
Set rs = Currentdb.Openrecordset("myData")
Open "MyNewDataFile.csv" for Output as #1
While  not rs.eof
strExport = rs(0) & "," & rs(1) & ",""" & rs(2) & """,""" & rs(3) & 
"""," & rs(4)
Print #1, strExport
rs.MoveNext
Wend
End Function
  
-- 
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System 
Support.





More information about the AccessD mailing list