Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2014

    Lightbulb Unanswered: Import Generated Report Text File into Access

    Hello everyone,

    I'm wondering if I could get some help importing a text file similar to that attached. The information between the dashes is considering one listing of information and there can be more than one. Each listing of information will be separated by dashes. The text on the first row is not needed. The work center and dates are needed. The next couple lines are just titles for information below. Each bit of that information is needed. I'll also need the line with "12345 asdf" on it. I think I can use character search function but how do I designate to look at each entry separated by dashes?

    Thanks in advance to anyone who is willing to help out.

    PS: I'm sorry if there's already a thread that will work for this. I could not think of an accurate search to find something like this.
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    You'll need to write what is called a document parser. If the same piece of information can always be found at the same position on a line, this is rather simple.
    1. Read a line
    2. Perform a search based on keyword(s) and length to determine what the line is (header display, data header 1, data header 2, data, empty line, footer).
    3. If the line contains data, split it into its components.
    4. Store these components into the table (dynamic query or Recordset).
    5. Next line (process until EOF).

    Another system would be based on line counting but it would probably be less reliable.
    Have a nice day!

Tags for this Thread

Posting Permissions

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