Dim n, nTotal Dim cnn, rst
Set cnn = CreateObject("ADODB.Connection")
Set rst = CreateObject("ADODB.Recordset")
strPathtoTextFile = "C:\Databases"
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoTextFile & ";" & _
"Extended Properties=""text;HDR=YES;FMT=Delimited"""
rst.Open "SELECT * FROM accounts.csv WHERE client_id="
& CInt(mailer.fields("client_id")), cnn
n = 1
nTotal = 0
Do Until rst.EOF
mailer.write("invoice" & n & ", ")
mailer.write(rst("totalamount1") & ", ")
mailer.write(rst("due"))
if Len(rst("attach")) > 0 then mailer.attachFile(rst("attach"))
mailer.write(vbCrLf)
n = n + 1
nTotal = nTotal + rst("amount")
rst.MoveNext
Loop
rst.Close
cnn.Close
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE