Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2006
    Posts
    157

    Unanswered: Microsoft Scripting Runtime

    Hi: I add Project-References Microsoft Scripting Runtime but it still gives me syntax error on that line.

    Set OutStream = FSO.CreateTextFile(Source, True)

    Private Sub Form_Load()
    Export
    Main = DTSTaskExecResult_Success
    End Sub

    Public Sub Export()
    Dim DBConn
    Dim RS, RCount
    Dim FSO, OutStream
    Dim I
    Dim OutBuff
    Dim Source
    Dim Str
    Dim Destination
    Dim DT

    Set DBConn = CreateObject("ADODB.Connection")
    DBConn.OPEN "Provider=SQLOLEDB; Data Source=OMS0062K\DEVELOPMENT; Initial Catalog=AccountDistribution; User ID=sa"
    Set RS = DBConn.Execute("SELECT * FROM tbl_DistList_DEP_duplicate")
    Set FSO = CreateObject("Scripting.FileSystemObject")

    DT = Now()
    DT = Replace(Replace(Replace(DT, ":", ""), " ", "_"), "/", "")
    'Source = "\\Usnymel1fs001\MortgageLeads\OMSUL" & DT & ".txt"

    If Not RS.EOF Then
    Set OutStream = FSO.CreateTextFile(Source, True)
    End If

    RCount = 0
    Do While Not RS.EOF
    Str = ""
    Str = RS.Fields("Clt_ID") & ","
    Str = Str & RS.Fields("cur_bal") & ","
    Str = Str & RS.Fields("list_date") & ","
    Str = Str & RS.Fields("debtor_id") & ","
    Str = Str & RS.Fields("name1") & ","
    Str = Str & RS.Fields("worklist") & ","
    Str = Str & RS.Fields("duplicate_count") & ","

    OutStream.WriteLine Str
    RCount = RCount + 1
    RS.MoveNext
    Loop

    Destination = "c:\myfiles\"

    If RS.RecordCount > 0 Then
    FSO.CopyFile Source, Destination, True
    OutStream.Close
    End If

    Set FSO = Nothing

    UpdateDB RS, RCount, DBConn

    End Sub

    Public Sub UpdateDB(RS, RCount, DBConn)
    Dim UpdStr
    If RCount > 0 Then
    UpdStr = "("
    RS.MoveFirst
    Do While Not RS.EOF
    UpdStr = UpdStr & "'" & RS.Fields("Debtor_ID") & "',"
    RS.MoveNext
    Loop
    If Len(UpdStr) > 2 Then
    UpdStr = Left(UpdStr, Len(UpdStr) - 1) & ")"
    DBConn.Execute ("Update Mortgage_Leads Set Processed = '1' where debtor_id in " & UpdStr)
    End If
    End If

    DBConn.Close
    Set DBConn = Nothing
    Set RS = Nothing
    End Sub

    'Function Main()
    ' Export
    ' Main = DTSTaskExecResult_Success
    'End Function

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    You have the line that populates Source commented out.
    Inspiration Through Fermentation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •