Stuart McLachlan
stuart at lexacorp.com.pg
Sat Oct 15 05:52:32 CDT 2005
On 15 Oct 2005 at 12:03, Gustav Brock wrote: > Go to Seth's site: > > http://www-personal.ksu.edu/~sgsax/download/file_io.txt > >>> robert at servicexp.com 15-10-2005 02:20 >>> > > Hello, All > Does anyone have some text exporting code that I can use.. I need to > come up with a system that will pull data from multiple tables, format > the data, name fields and export said data out in a very specific fixed > width txt file. > The only thing to change in Seth's code is how to build the output string since you need fixed width. The way I build fixed width strings for output is something like this: Function Pad(TextString,StringLength) a String 'outputs a fixed length string 'pads short strings with spaces and truncates long strings Pad = Left$(TextString & Space$(StringLength),StringLength) End Function ....... strOutput = Space$(intTotalStringLength) 'Insert a Text field Mid$(strOutput,1) = Pad(!Field1,10) 'Insert a Numeric field Mid$(strOuput,11) = Pad(Trim$(Str(!Field2)),10) .... -- Stuart