I need to search a random access file's records for a specific string. Any ideas?
Printable View
I need to search a random access file's records for a specific string. Any ideas?
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