Hi Everyone!
Long time, no post. Here's today's quandry...
I'm trying to tell my script to only do a function on those files that are identified by a couple of queries. I actually use a couple of entries from recordsets to construct the string filenames, but I'm having something of an issue with the syntax in creating that string value and then manipulating the value correctly to pass through the rest of the function code. The error I currently get references the line "for each f in fc = "(rs3("Acct")&"_"&(rs2("Date")&".ps"" with the error "Expected end of statement". I'm missing something - what the heck is it?
As always, thanks for taking the time to take a look.
Tim
Long time, no post. Here's today's quandry...
I'm trying to tell my script to only do a function on those files that are identified by a couple of queries. I actually use a couple of entries from recordsets to construct the string filenames, but I'm having something of an issue with the syntax in creating that string value and then manipulating the value correctly to pass through the rest of the function code. The error I currently get references the line "for each f in fc = "(rs3("Acct")&"_"&(rs2("Date")&".ps"" with the error "Expected end of statement". I'm missing something - what the heck is it?
As always, thanks for taking the time to take a look.
Tim
Code:
Function Test()
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim fso, ts, source, fc, dbII, dbIII
dbII = "Advent_Reports"
dbIII = "NCC_DW"
set con2 = CreateObject("ADODB.Connection")
set con3 = CreateObject("ADODB.Connection")
strCon2 = "driver={SQL SERVER};server=SERVER;uid=user;pwd=pwd;database=" & dbII & ""
strCon3 = "driver={SQL SERVER};server=SERVER;uid=user;pwd=pwd;database=" & dbIII & ""
con2.Open strCon2
con3.Open strCon3
sql2 = "select FileAsOfDate as Date, Period as Period" & _
" from Advent_Reports.dbo.BowneTags "
set rs2 = CreateObject("ADODB.Recordset")
rs2.Open sql2, con2
sql3 = "select Acct_Nbr as Acct" & _
" from NCC_DW.dbo.Account_Status" & _
" where Reason is not null and ReasonIO is not null and Period = "&(rs2("Period"))
set rs3 = CreateObject("ADODB.Recordset")
rs3.Open sql3, con3
Set fso = CreateObject("Scripting.FileSystemObject")
set source = fso.GetFolder("f:\advent\wrc\ps\"&(rs2("Date"))&"\In_Progress")
set fc = source.Files
for each f in fc = "(rs3("Acct")&"_"&(rs2("Date")&".ps"
(DO STUFF)
rs2.Close
rs3.Close
set rs2 = Nothing
set rs3 = Nothing
End Function