Reuben Cummings
reuben at gfconsultants.com
Mon Oct 17 09:27:17 CDT 2005
I just did this and my system uses a table that holds the field name, how long the field should be when text, and if there should be leading zeros or trailing blanks. This way I can create a text file for any database I have just by typing in the field names I need extracted and the data type and length required for output. In this case, I had some data that was numbers and the state required that they have leading zeros - that's why I mention data type. Then it uses code similar to Seth's or Stuart's to create the actual string. Reuben Cummings GFC, LLC 812.523.1017 > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Stuart > McLachlan > Sent: Saturday, October 15, 2005 5:53 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Re-Invent The Wheel?? > > > 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 > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >