Page 1 of 2 12 LastLast
Results 1 to 15 of 17

Replace new lines after search string with corresponding text with a tab

  1. #1
    tuandelia is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    9

    Replace new lines after search string with corresponding text with a tab

    Hi all, please help. I am not new to access but I'm not a programmer.


    I need to loop through text files and replace the new lines following the from, to, copy and subject fields with tabs and place the associated text on the same line as the from, to, copy and subject fields.

    I start out with this. Please see below.
    From:

    ABC COrp@abc.com
    To:
    XYZ Inc.@xyz.com
    Copy:


    Me@abc.com; Myself@abc.com; Irene@xyz.com

    Subject:


    NOthing much

    I need it to be like this.

    From:ABC COrp@abc.com
    To:XYZ Inc.@xyz.com
    Copy:Me@abc.com; Myself@abc.com; Irene@xyz.com
    Subject:NOthing much

    How can I do this in access? Any assistance would be greatly appreciated.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,624
    Have you looked into the Replace() function?
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

  3. #3
    tuandelia is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    9
    Yes, but I don't know how to apply to do what I need to do here.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,624
    I've got a meeting to attend so I'll need to leave now. I'll check in when I get back.
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,624
    Sorry it took so long to return. Will this be an ongoing task or just a one time process? What will you be doing to the text file after it is modified?
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

  6. #6
    tuandelia is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    9
    No problem and thanks for getting back to me. This will be an on-going project and after the text files have been modified I will extract the objective information from email threads.

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,624
    Do you build the Text file or does it come from someone else? Can you post a copy of one of the samples? Is it always in a consistent format?
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

  8. #8
    tuandelia is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    9
    There are coming from many different sources and depending on the email server the format is not always consistent. Will post a sample shortly. Thank you for your help.

  9. #9
    tuandelia is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    9
    Sample below. the information I need is actually at the bottom of the file.
    ha ha ha


    Hello


    goodbye


    See ya later


    We've checked with Xirgo regarding any possible interruption in the supply chain driven my the earthquake in Japan. We have not direct link to components that are sourced from Japan, but expect at least some moderate trickle effect as other contract manufacturers from other countries may be picking up the slack from Japan.





    OEM activities


    Had a conference call with Hyundai last month. Several corporate employees from South Korea were in attendance via California. I believe they are planning on coming to Cleveland in the spring to continue discussion. I reiterated our prior communication that we have a UBI patent in the U.S., and that we would be happy to work out an agreement with them to get driving data from their vehicles without our device.





    Write-offs


    4,408 devices were written off in February, valued at $258,358.





    To date 94,874 devices have been written off, for an adjusted value of $6,585,570.















    Device Spend


    Actual spend to date is shown in the table below. We have a commitment with orders through 2Q11. For the remainder of 1Q, we are purchasing 4,000 devices per week at a cost of $63.55 (last week of March will drop to $61.75). Starting in 2Q, the purchases will increase to 5,000/week to accommodate the national launch, providing a safety level of inventory in case the demand is heavier than expected.


















    MyRate Paid Claims Summary as of February 2010 Month End


    Not yet provided by claims.





    Inventory Levels










    From:




    ABC COrp@abc.com


    To:


    XYZ Inc.@xyz.com


    Copy:






    Me@abc.com; Myself@abc.com; Irene@xyz.com




    Subject:






    NOthing much

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,624
    Can we at least depend on
    From:
    To:
    Copy:
    Subject:
    ...in the right order in the file? Will there only be one such capture in each file? Will the output all be in one file or in separate files?
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

  11. #11
    tuandelia is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    9
    Sometimes but not always. There will be one or multiple captures in each file, but the output will be in one file. Does this make sense?

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,624
    Each time you run this procedure it could append to the existing output file if that works for you. Not having something to absolutely depend on in the input file could be problematic as you know computers are really dumb and predictable.
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

  13. #13
    tuandelia is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    9
    I would like to generate a new text file with only the information I need. I know that that is problematic because the code would have to be tweak each time I encounter a sets of files that are formatted differently.

    Thank you very much for any assistance.

  14. #14
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,624
    I'll give it a try. It may take a day or two.
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

  15. #15
    tuandelia is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    9
    Thank you so very much for your assistance.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query To Search Text String
    By JeffGeorge in forum Queries
    Replies: 2
    Last Post: 08-15-2013, 09:56 AM
  2. Replies: 14
    Last Post: 01-15-2013, 05:07 PM
  3. Replies: 2
    Last Post: 09-11-2012, 11:34 AM
  4. Replies: 1
    Last Post: 02-02-2012, 05:22 PM
  5. Replace a string/text in ms-access db
    By anziga in forum Queries
    Replies: 4
    Last Post: 12-31-2010, 05:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums