Link to home
Start Free TrialLog in
Avatar of Shawn
ShawnFlag for Canada

asked on

delete last carriage return

at the end of the string below I get 2 or 3 carriage returns. How would I get rid of these?
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 = 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 & "445713,," & 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

sSql = Replace(sSql, vbCrLf & vbCrLf, vbCrLf)

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of cyberkiwi
cyberkiwi
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Shawn

ASKER

perfect. thank you