Boy... I think you have a loooong way to learn the DB language. My adwise to you is to start with something really easy, and work your way to the top. Maybe you should have posted this in the Newcomers Corner.
But don't worry, I'll try to help you anyway...
Every variable is is not global, so you have to specify the Title$ in the function declaration. The Function also have to return some kind of result, In this case the file where the search string is found. The Open To Read command should only be used once to open the file (not to read it). The variable Numb$ cammot be increased because it's a string varible.
This is coded right out of my head. This means that I did not test if it works. But try it anyway. This will not check files named like "Data_000.txt", because else it would be enormous. It checks files like "Data_1.txt", "Data_217.txt" or "Data_8311.txt". It doesn't either check "Data_5.txt" if all files with lower numbers does not exist and the start number is specified lower than 5. This function will return the filename of the file wich the string is found in.
Syntax:
Return String$ = Search_Data$(File$,StartNum,Extension$,LookForThis$)
Explanation:
Return String$ -> (String) This is the return string. It will be the full filename of the file wich the string is found in.
File$ -> (String) This is the name of the file before the number.
StartNum -> (Integer) This is the filenumber to start at.
Extension$ -> (String) This is the file extension inclusive the ".". (i.e. ".txt" or ".dat")
LookForThis$ -> (String) This is the string to look for in the files.
The Function:
Function Search_Data$(File$,StartNum,Ext$,FindString$)
Numb=StartNum
NotFound:
FileName$=File$+Str$(Numb)+Ext$
If File Exist(FileName$)=1
Open To Read 1,FileName$
Repeat
Read String 1,String$
If String$=FindString$ Then ExitFunction FileName$
Until File End(1)=1
Close File 1
Inc Numb
Goto NotFound
EndIf
EndFunction "String Not Found!"
Hope that helped...
Post here if it does...
Happy Learning... TheCyborg.
Ps: Phew. That's my longest post I ever posted...