+ Reply to Thread
Results 1 to 5 of 5

Find and paste from text file

  1. #1
    Forum Contributor
    Join Date
    09-18-2008
    Location
    Scotland
    Posts
    156

    Find and paste from text file

    Hi,
    I previously posted this on the Excel Programming board but I haven't been able to get it completed over there, so a colleague recommended that I try and use Access to complete my query using the wonders of recordsets.

    Here is my original thread

    Basically, from the attached .txt file I am looking for 4 pieces of data to be pulled into a table.
    After the 1st 4 pieces have been pulled in then I'd like to move to the next occurance of the data and then extract this and keep doing this until
    we reach the end of the file.
    The 4 pieces of information are:

    Transaction Type : And the information after it on the same line up to 60 chars
    The very next line with the name on it e.g. Mr Billy Murphy
    The next again line, but just the first 60 characters
    This last line with Batch on it along with the number.

    Then move to the next set of data and extract that.

    I'd like each piece of info to be the table with all the transaction types in one column, the names in the next column etc.
    Is this doable? Can anyone help and if so do you need any more info from me?


    Many thanks.
    Attached Files Attached Files
    Last edited by guerillaexcel; 02-15-2011 at 04:38 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2507 Win 11
    Posts
    24,921

    Re: Find and paste from text file

    You will need to clean up your text file in order for Access to do anything with it. It will need to resemble some sort of logical table. Access will not have any way of handling your request with the text file in the current format. To many headers (non-data information) in the file that needs to be removed and the data is not arranged in any table friendly format that will allow Access to work on it.

    A suggestion may be to ask if the text file you are receiving can be re-formatted to a more user friendly (for analysis) format can be achieved. Is text the only available output of this report?

    Alan
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    09-18-2008
    Location
    Scotland
    Posts
    156

    Re: Find and paste from text file

    Hi Alan,

    Thanks for your reply, I thought that as much but unfortunately this is the only format the report is available in. I have stripped away much of the company info but everything that I require is still on the report.
    Is it not possible to import the report to Access, then using a script search for the first term ie "Transaction Type" and then return the 4 lines?

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2507 Win 11
    Posts
    24,921

    Re: Find and paste from text file

    Because Access is table driven, I don't see how you can do this. The columns in a table represent fields -- how would you distinguish between labels and data you import if they lie in the same "column?" Each row in a table represents a record. How would you account for the term transaction in the record? I'm thinking that you have a spreadsheet mindset here and not a relational database mindset.

    This link might help you get a better understanding.

    http://forums.aspfree.com/microsoft-...el-349267.html

    Alan

  5. #5
    Forum Contributor
    Join Date
    09-18-2008
    Location
    Scotland
    Posts
    156

    Re: Find and paste from text file

    solved it, not the cleanest method but it works for me. Basically imported my text file, then moved to each recordset, looked for a specific term and then returned the next 4 lines into a different text file, separated them by using a ";" and then can easily import to Access table or spreadsheet.
    Cheers

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1