Robert Gracie
robert at servicexp.com
Mon Oct 17 17:08:21 CDT 2005
I worked on my little project/problem over the weekend, attempting to use a class based solution and of course having some problems. So needless to say My hand is raised up high!!! It really would be cool to have a set objects that could handle most text exporting needs one may have.... Robert Gracie -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Colby Sent: Monday, October 17, 2005 11:15 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Re-Invent The Wheel?? I do the same thing, only I have a class pair that does it. I have a parent/child table pair - the name of the query or table that the data is coming from, then a table of the fields for that query/table. The field table has fields for the ID of the parent query/table record, name of the field being formatted and the formatting string. I use the formatting string to just coerce the data into a formatted string using format$(data, format$). The controller class is passed the name of the query so that it opens the query as a recordset. It then opens the appropriate data set in the child Fields table, and reads out the fields into field classes. Each field class "knows" how to format the data since each field class instance is fed all of the data from one of the field records that you mention - the field name and the format string. Then the controller class just steps through the recordset, calling the appropriate field class instance and telling it to format the data and return the string. The controller class appends the strings returned from the field classes and writes the finished string out to the text file. As you can probably guess, mine is tied to my framework and therefore isn't easily extractable, however the class pair concept is dead easy to implement. If AccessD would like to get together a development team to work on this we could build a little library that implements the package and put it up on AccessD's (and my) site for download. I can put up a forum on my site to use for the dev team. If anyone wants to do this raise your hand. If we have sufficient interest I would be willing to lead the team (if you want). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Reuben Cummings Sent: Monday, October 17, 2005 10:27 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Re-Invent The Wheel?? 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. > > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com