[AccessD] Table Export to text - decimals truncate

Stuart McLachlan stuart at lexacorp.com.pg
Tue May 25 18:05:46 CDT 2004


On 25 May 2004 at 12:30, Martin Kahelin wrote:

> That works except it turns the value (last) to a string like this
> 
> "0444","COST","011100007","REG","O21",536.00,,"0.4375"
> 
> I need it as a value
> "0444","COST","011100007","REG","O21",536.00,,0.4375
> 
> export keeps chopping the the data to
> "0444","COST","011100007","REG","O21",536.00,,0.43
> 
> -does it in acc97 and acc2002
> 

One of the reasons I never use TranferText to do exports. :-)

If you roll your own, you can format any way you want.

Here's a DAO example (outline, aircode, so will need tweaking)

Function Quoted( PlainString) as String
  Quoted = Chr$(34) & PlainString & CHr$(34)
End Function

Function ExportQuery() as Long
Dim rs as Recordset
Dim strExport as String

Set rs= CurrentDB.OpenRecordset("myQuery")
Open "MyData.csv" for Output as #1
Do While Not rs.eof
   Print #1, Quoted(rs(0)) & "," & Quoted(rs(1) & "," _ 
                Quoted(rs(2)) & "," & Quoted(rs(3) & "," _ 
                Format(rs(4),"0.00") & "," & rs(5) & "," _
               Format(rs(6),"0.0000") 
Loop
Close #1
End Function

 
-- 
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System 
Support.






More information about the AccessD mailing list