I use vb 6.0 to run a sql to which I pass parameters like statrt date and end date from
vb to sql.. and then print results to a file.
Private Function Build_Query(sFileName As String, customer As String, sFolderLoc As String)
Dim sInput As String
Dim sOutput As String
Open sFileName For Input As #1
Line Input #1, sInput ' Get a line of input from the file(sFileName) and store it in the sInput
sOutput = sInput
Do While Not EOF(1)
Line Input #1, sInput
sOutput = sOutput & Chr(10) & sInput
sOutput = Replace(sOutput, "&BEGDATE", "'" & strBegDate & "'")
sOutput = Replace(sOutput, "&ENDDATE", "'" & strEndDate & "'")
sOutput = Replace(sOutput, "&customer_LIST", svcbr)
Build_Query = sOutput
Open sFolderLoc & "\List_" & Format(strEndDate, "mmm") & "_" & Format(runDate, "mm""-""dd""-""yyyy") & ".txt" For Append As #5
Print #5, "This Report was run was for " & customer
and then I make a call to the function build_query like this:
customer = "(1,7)"
sSQL = Build_Query(SQL_Home & "\sqlFileName.sql", customer, sFolderLoc)
If you notice I am hard coding the cutomer list like this:customer = "(1,7)"
Instead , I want to create a text file(using notepad) and store the customer values there in a folder and then use
that in my code,, so that every time the user changes the customer list, I dont have to change my code, instead i can just
change the text file contents.
How do I do this? Please add changes to my code to be specific.