Stuart McLachlan
stuart at lexacorp.com.pg
Thu Apr 1 21:48:33 CST 2004
On 1 Apr 2004 at 20:08, John W. Colby wrote: > Whoa, thanks for that. It never would have occurred to me to do that. > > I have a file spec with all the fields and their start / stop positions, as > well as the format. I kinda figured I'd build a table that has all of that > info plus my corresponding field name (it's a rather monstrous query since > it pulls from about a dozen normalized tables). Then build a function that > opens the recordset and builds each record based on their field spec table. > > In the end, what a PITA. But your suggestion will definitely make things > easier. > You will probably find that some data is left justified and others right justified, possibly with different numbers of decimal places. If you store a RightJustify flag and NoOfDecimalPlaces in your table along with the start position and length you can then build quite a simple function to step through each field in the table, read and format values appropriately and poke them into the correct positions. It ends up being quite trivial to do, regardless of how big/complex the required output row is. The big advantage is that you can handle subsequent changes in the output spec very easily. (It's sort of a "space delimited export framework" <g>) -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support.