Results 1 to 4 of 4

Thread: Flat file

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Posts
    81
    I need to be able to check a flat file for key phrases How can I do this:

    Exampe.

    ITEM_BLOCK MASTER_MAINTENANCE /ROW=3 /COL=7 &
    /FACILITY=MENU_MASTER_MAINTENANCE

    I need to look for /Facility in the block above..

    Thanks
    Brooke

    -------------------------
    There is never only one right answer. That is the magic of programming.
    -------------------------

  2. #2
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    fastest and easiest way is to pop the file into a richtext box control. This control has a built in "Find" function. If you need further help, send me your email address and I will send you a sample file tonight.
    Chemically Formulated As:
    Dr. Nitro

  3. #3
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    I sent a file call "Richie Rich.Zip". It should have what you are looking for.

    See Ya
    Chemically Formulated As:
    Dr. Nitro

  4. #4
    Addicted Member jcouture100's Avatar
    Join Date
    Aug 1999
    Posts
    141
    If you're looking to check a file for a key phrase without actually having to display the file then you can use the InStr function. The example code below opens the C:\Autoexec.bat file and searches it for the Word "DOS".

    Code:
        Dim strLine As String
        Dim intAnswer As Integer
        Dim strFind as String
        Dim strFile as String
    
        strFind = "DOS"
        strFile = "C:\autoexec.bat"
    
        Open strFile For Input As #1
        Do While Not EOF(1)        ' Loop until end of file.
            Line Input #1, strLine ' Read line into variable.
    
            'Look for specific text.
            intAnswer = InStr(1, strLine, strFind)  
    
            If intAnswer <> 0 Then
                MsgBox "String Found"
            End If
        Loop
        Close #1    ' Close file
    Hope this helps.
    JC

Posting Permissions

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



Click Here to Expand Forum to Full Width