Results 1 to 2 of 2

Thread: Search for a string

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2000
    Posts
    6

    Exclamation

    I need to search a random access file's records for a specific string. Any ideas?

  2. #2
    Lively Member Ianf's Avatar
    Join Date
    Mar 2000
    Location
    Leigh, Lancashire, UK
    Posts
    96

    Lightbulb Why Not?

    Why don't you just open the file and parse it. Comparing each line to string you are searching for i.e

    Const SearchString = "Blah Blah Blah"
    Dim FileNumber As Integer
    Dim FileName As String
    Dim Data As String

    FileNumber = FreeFile
    FileName = "C:\filename.txt"

    Open FileName For Input Access Read As #FileNumber

    Do Until EOF(FileNumber)

    Line Input #FileNumber, Data
    IF Data = SearchString Then msgbox "Hooray"

    Loop
    Close #FileNumber

    Hope this helps
    Ian Frawley
    Software Engineer
    E-mail [email protected]

    BEING IN THERAPY
    And yet, having therapy is very much like making love to a beautiful woman. You... get on the couch, string 'em along with some half-lies and evasions, probe some deep dark holes, and then hand over all your money.

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