Hello all,
first time posting a question.
I have a list of report names in two different directories, one being an archive, the other reports that are overwritten monthly. The archived reports start with a year_month_. The web has drop down option boxes for year and month.
So far, everyting works great. I am creating the archive based on user login (determines which reports can be "released" or "signed off". So, the reports also include a division name in the title. However, once the reports are signed off, anyone may look at them.
So, how do I pick one particular report out of many? My idea was to list the reports, using instr to search for both the report name and the requested month and year. It works, but then just moves onto the next file, so that the variable for report name is continually replaced and made useless. How do I say until this, do that, save last? Here is my code. The response.write stuff is just trouble-shooting junk.
Function PagePath()
Dim Mth, Yr
vServer = Request.ServerVariables("SERVER_NAME"
s=" & vServer & "/SafetyFirst/Reports/"
a=" & vServer & "/SafetyFirst/Archive/"
Mth=trim(request("Mth")
Yr=trim(request("Yr")
Connector = "_"
if Yr = "CurrentY" then
PagePath=s
ReportPrefix = ""
Else
If Mth = "CurrentM" then
PagePath=s
ReportPrefix = ""
Else
ReportPrefix= Yr & Connector & Mth & Connector
PagePath=a
End If
end if
dim filename, filecollection, strArchivePath, strCurrentPath, strFileExt
strArchivePath= "\\" & vServer & "\
'establish path to input and output files
Set objfso = CreateObject("Scripting.FileSystemObject"
Set objArchive = objfso.GetFolder(strArchivePath)
If ReportPrefix <> "" then
Set filecollection = objArchive.Files
For Each filename in filecollection
vResult = (Instr(filename, reportprefix))
xResult = (Instr(filename, strReport))
Response.Write "strReport = " & strReport
Response.Write filename
Response.Write xResult & " = xResult"
Response.Write vResult & " = vResult"
if vResult <> 0 and vResult <> "" and xResult <> 0 and xResult <> "" then
strReport = filename
end if
Next
End if
End Function
%>
first time posting a question.
I have a list of report names in two different directories, one being an archive, the other reports that are overwritten monthly. The archived reports start with a year_month_. The web has drop down option boxes for year and month.
So far, everyting works great. I am creating the archive based on user login (determines which reports can be "released" or "signed off". So, the reports also include a division name in the title. However, once the reports are signed off, anyone may look at them.
So, how do I pick one particular report out of many? My idea was to list the reports, using instr to search for both the report name and the requested month and year. It works, but then just moves onto the next file, so that the variable for report name is continually replaced and made useless. How do I say until this, do that, save last? Here is my code. The response.write stuff is just trouble-shooting junk.
Function PagePath()
Dim Mth, Yr
vServer = Request.ServerVariables("SERVER_NAME"
s=" & vServer & "/SafetyFirst/Reports/"
a=" & vServer & "/SafetyFirst/Archive/"
Mth=trim(request("Mth")
Yr=trim(request("Yr")
Connector = "_"
if Yr = "CurrentY" then
PagePath=s
ReportPrefix = ""
Else
If Mth = "CurrentM" then
PagePath=s
ReportPrefix = ""
Else
ReportPrefix= Yr & Connector & Mth & Connector
PagePath=a
End If
end if
dim filename, filecollection, strArchivePath, strCurrentPath, strFileExt
strArchivePath= "\\" & vServer & "\
'establish path to input and output files
Set objfso = CreateObject("Scripting.FileSystemObject"
Set objArchive = objfso.GetFolder(strArchivePath)
If ReportPrefix <> "" then
Set filecollection = objArchive.Files
For Each filename in filecollection
vResult = (Instr(filename, reportprefix))
xResult = (Instr(filename, strReport))
Response.Write "strReport = " & strReport
Response.Write filename
Response.Write xResult & " = xResult"
Response.Write vResult & " = vResult"
if vResult <> 0 and vResult <> "" and xResult <> 0 and xResult <> "" then
strReport = filename
end if
Next
End if
End Function
%>