Results 1 to 11 of 11

Thread: input file

  1. #1
    Join Date
    Sep 2007
    Posts
    19

    Unanswered: input file

    Hi everyone,

    I need to import records from a TXT file and to save the data into a table; I want To make flexible the procedure, because the data file and the lenght of data in it, is not the same;
    so I think first to insert in a form a list of fields (name and lenght), and after open the file data and import rows in a new table make it .

    Can you help me?

    Thank...

    Sorry for my bad english....

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I'm assuming you mean "number of columns" when you use the term "length"?
    If so; the first question I have is "why do you have different formats?"

    However, if you're using the term length to describe the number of records in the file then it's a bit of a non-issue.
    George
    Home | Blog

  3. #3
    Join Date
    Nov 2003
    Posts
    1,487
    Firstly....Welcome to dbforums.

    Secondly....Your English is just fine. I think it is the way you are presenting your problem that is the issue here.

    Thirdly....What?

    Do you mean that you have a crap load of Text files coming to you which are in some form of delimited format and you would like to place the data contained within these text files into specific database tables of your database? .... And because the required Data Types can be different from one text file to another, you would like to also differentiate between the possible Types and perhaps even create tables on the fly based on the contents of those text files?

    Sure.

    A sample of the text files you are getting might be helpfull. Perhaps a little more in depth description of what you are really trying to do might work pretty good right about now to.

    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


  4. #4
    Join Date
    Sep 2007
    Posts
    19

    import files

    Hi

    I want create a flexible procedure to import TXT files.

    The format for ex. is:
    NameSurnameCityEcc
    xxxxxyyyyyyyzzzz###

    The name, the type, and the lenght of the field are different in each files.

    When I import data, in a form I insert:
    1- the name and the path of file;
    2- the name, the type, the lenght of each data field in the file to import.

    After, I want:
    1- to save the parameters for future imports (text or ini file?);
    2- to create tables on the fly based on the contents of that text file.

    Is it too difficult?

    Thanks in advance

    Danit58

  5. #5
    Join Date
    Nov 2003
    Posts
    1,487
    To difficult?........Not really. What you are looking for appears to be a dialog that would handle such a task and if this is the case then we obviously would need to creat an interface to work with things, but before I get to carried away ............

    These tables you intend to create on the fly...they are temporary...right? I mean, after all, it wouldn't take long before you've reached your DB table limit if you were to create a new table for every text file that you selected ..... would it? I think not... this would of course be why you would like to save the file location etc. to another table (I hope).

    So with all that in mind......we need to (and please tell me if I'm wrong):

    1) Create a Form which we would use as our interface for locating, selecting, and saving our Text File particulars.

    2) With this same Form (behind the scenes so to speak), we need to save the File Path, File Name, and other particulars about the File to a perminent table within our database (or another database...whatever)

    3) Again with this same Form we need to extract the delimited data (hopefuly) from the selected Text file(s) and generate individual temporary tables which would be based from the data and Types within those Text files.

    4) Perhaps even generate specific Reports based on the data accuired from these temporary tables.

    5) Delete the temporary tables once we are finished diddling (playing) with them.
    6) Go home and make babies cuz now we have time to do so

    Is this what you're thinking about?

    If so, I then go back to my previous post. We need to have samples of these Text files so that I can build this thing because there is one certainty in this world....I'm not gonna explain it all within this thread.

    I feel the best way to show or explain this is by example and if I have time, I will be more than willing to pump something out for you and attach it to this thread because one other certainty in this world .... you're not the only one that is wanting to attempt this sort of thing.

    Ask me if I'm bored

    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


  6. #6
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Importing

    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  7. #7
    Join Date
    Sep 2007
    Posts
    19

    import file

    Thanks for your ideas.

    1) Create a Form which we would use as our interface for locating, selecting, and saving our Text File particulars.
    OK

    2) With this same Form (behind the scenes so to speak), we need to save the File Path, File Name, and other particulars about the File to a perminent table within our database (or another database...whatever)
    This parameter are temporary

    3) Again with this same Form we need to extract the delimited data (hopefuly) from the selected Text file(s) and generate individual temporary tables which would be based from the data and Types within those Text files.
    the data are Delimited or Fixed (look the 2 attacched files). I need to save data in a new table, peraphs a new permanent table in mdb, or to append data in a existing table with the same fields

    4) Perhaps even generate specific Reports based on the data accuired from these temporary tables.
    OK

    5) Delete the temporary tables once we are finished diddling (playing) with them.
    If necessary, I want decide it.

    by
    Attached Files Attached Files

  8. #8
    Join Date
    Nov 2003
    Posts
    1,487
    I am working on it...please be patient.

    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


  9. #9
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    ...anything wrong with the inbuilt Access import routines. Persoanlly I hate having to write code for something that already exists out there, is known to work. It seems like what you want to do is already covered by the import wizard, once you have run that wizard Im pretty certain you can save that import spec, so next time round the same file can be handled with the minimum of fuss.

    otherwise you are in to writing your own custom import routine..... not that Im against that.. they can be demanding, but unless I've got to append to multiple tables at the same time. or do some complex validation before data can be entered then I dont see the point in wasting precious development time when perfectly good routines are available off the shelf
    I'd rather be riding on the Tiger 800 or the Norton

  10. #10
    Join Date
    Sep 2007
    Posts
    19
    Hi CyberLynx

    Have you news for me?

  11. #11
    Join Date
    Nov 2003
    Posts
    1,487
    Indeed...I have been woking on it (when I have time) but I do have some questions and they have been put to you via E-Mail.

    On the same note:

    healdem is absolutely right about the MS-Access built in Import routines. The Import wizard is quite competent for importing data from several different means and formats. In the most part, it can accomplish the most common scenarios flawlessly but, like everything else in this world, there is always a time when the only thing that will do exactly what you want is the thing you make yourself (so to speak)

    For me....this topic will now continue through E-Mail until its completion and if you so wish (danit58) ...the outcome will be posted here.

    .
    Environment:
    Self Taught In ALL Environments.....And It Shows!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •