Shawn
asked on
export string to csv file
I have a string I would like to export to a csv file but am not sure what I am doing wrong. I think it may be in the DoCmd.TransferText.
Any ideas?
Any ideas?
Dim rs
Set qd = CurrentDb.QueryDefs("qryInvoice_1ToExportToAccountingInsert")
For cnt = 0 To qd.Parameters.Count - 1
qd.Parameters(cnt) = Eval(qd.Parameters(cnt).Name)
Next cnt
Set rs = qd.OpenRecordset()
Do While Not rs.EOF
'Amount including tax
sSql = "411000," & rs!ClientCodeID & ",0," & rs!TotalIncludingTax & "," & rs!InvoiceDate & _
",VT," & rs!InvoiceCompanyName & "," & rs!InvoiceNumber & vbCrLf
'Amount excluding tax
sSql = sSql & "706100,," & rs!TotalExcludingTax & ",0," & rs!InvoiceDate & _
",VT," & rs!InvoiceCompanyName & "," & rs!InvoiceNumber & vbCrLf
'tax
If rs!TotalTax <> 0 Then
sSql = sSql & "445713000,," & rs!TotalTax & ",0," & rs!InvoiceDate & _
",VT," & rs!InvoiceCompanyName & "," & rs!InvoiceNumber & vbCrLf
End If
'rs.Edit
'rs("DateExportedToAccounting") = date
'rs.Update
'go to next recotd
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
DoCmd.TransferText acExportDelim, "", sSql, "H:\import\results.csv", False, ""
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER