How to extract text data from notepad using access vba 2007

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prasad joshi
    New Member
    • Aug 2012
    • 30

    How to extract text data from notepad using access vba 2007

    i want to extract text data from notepad file using access vba 2007 .....


    can any body tell me how to do this


    please give me sample examples if anyone have.



    thanks...
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    @prasad joshi

    Welcome to the bytes forum!

    Would you please review your question and provide more detail as to what it is you're having issues with?

    We'd also like to see any code that you may have already attempted; however, please remember to enclose the code within the [code] [/code] code tags.

    Without any further information as to the structure of the file you're trying to import all I can offer is the following:
    Get help with your questions about Microsoft Access with our how-to articles, training videos, and support content.



    Before you re-post your question, would you take a few moments to review the following:

    This is a must read!!! Posting Guidelines


    How to ask good questions

    FAQ

    Some other generally helpful links:

    I’ve found that all too often the textbooks really do a very poor presentation of the actual steps behind setting up a database from scratch. However, I have found a really good step by step tutorial for basic design here:

    A Tutorial for Access

    Although this may sound a tad late for your current project, this tutorial may yet give you some insight to any issues you may run into with your project in the near term and should help you with any future projects.

    Of particular note is >> tables <<page within the tutorial - notice the information that is given, the table name, the field name, the field type, key or index, etc... AND the format used to present that data.

    When you post back, this is the type of information we'll need to help you along in your project. You don't need a fancy grid table to do this... just a line by line layout.

    One of the hardest concepts for most people to understand is that of "normalization. " I found this link to have a really good really good explanation of the concept for those just starting out and I found it to be a good review when I read thru it:

    Database Normalization and Table Structures.

    Looking forward to helping you with your project...

    -z

    Comment

    • prasad joshi
      New Member
      • Aug 2012
      • 30

      #3
      i have note written any code I am totaly new

      Comment

      • zmbd
        Recognized Expert Moderator Expert
        • Mar 2012
        • 5501

        #4
        Then start with the two links provided to MS in my post.
        If those links do not help you develop a starting code, then we will need to understand what information is in the text file and how it is structured.

        -z

        Comment

        • ADezii
          Recognized Expert Expert
          • Apr 2006
          • 8834

          #5
          Notepad produces the simplest of all Text Files, the contents of which can easily be extracted and analyzed by any number of Methods. The following Code will Read each Line of a File produced by Notepad, Parse the contents of each Line, then Write the Results to the Immediate Window.
          Code:
          Const conPATH_TO_FILE As String = "D:\Test.txt"
          Dim strLine As String
          Dim varLineContents As Variant
          Dim intCtr As Integer
          
          Open conPATH_TO_FILE For Input As #1        'Open file.
          
          Do While Not EOF(1)                         'Loop until end of file.
            Line Input #1, strLine                    'Read line into variable.
              varLineContents = Split(strLine, " ")   'Parse Line contents using a Space
                                                      'as the Delimiter
              For intCtr = LBound(varLineContents) To UBound(varLineContents)
                Debug.Print varLineContents(intCtr),
              Next
                Debug.Print vbCrLf
          Loop
          
          Close #1    ' Close file.
          1. The File D:\Test.txt:
            Code:
            SHE SELLS SEA SHELLS AT THE SEA SHORE
            Hello World
            Beauty is in the eyes of the beholder
          2. OUTPUT to the Immediate Window:
            Code:
            SHE           SELLS         SEA           SHELLS        AT            THE           SEA           SHORE         
            
            Hello         World         
            
            Beauty        is            in            the           eyes           of            the           beholder

          Comment

          • prasad joshi
            New Member
            • Aug 2012
            • 30

            #6
            this program dont give any output

            Comment

            • zmbd
              Recognized Expert Moderator Expert
              • Mar 2012
              • 5501

              #7
              Prasad;

              As I have indicated in another thread that you started, You usually will not get a completed code provided to you unless you have posted what you have already tried.

              This is a basic I/O homework style question asked in every Computer Science class I've ever taken... from highschool thru college.

              Please post the work you already have undertaken or avail yourself of the information I and ADezii have proveded.

              Use the external data emport from the ribbon
              Use the transfer method
              Open a file for input using the standard BASIC i/o commands

              -z

              @ADezii: code work exactly as described in the post in my test database... :) )

              Comment

              Working...