Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Carriage return 1

Status
Not open for further replies.

ebase

MIS
Jan 7, 2004
40
US
Hello all,

For some reason at the end of this script, a carriage return is placed. The output I get is the following:

INSERT INTO [table-1] ([invoice #], [customer], [customer code], [Customer PO#], [PMT Terms], [Category], [Unit], [Sales Unit Price $]) VALUES ('7-1554-01', 'Company Name', 'C000006', 'AE41403', 'Net 30 Days after B/L Date', 'PASTE', 'kgs', 82.00
);

as you can see the ); is for some reason after a carriage return and I do not know why this is happening. I do not know anything about VB and the creator is no longer here. Any help would be appreciated! Thanks.

Lines of code are:

priceStr = Right(newStr, Len(newStr) - 6)
updStr = "INSERT INTO [table-1] ([invoice #], [customer], [customer code], " &_
"[Customer PO#], [PMT Terms], [Category], [Unit], [Sales Unit Price $]) VALUES ("&_
"'" & updInvoice & "', Company Name.', 'C000006', " &_
"'" & ML_ORDER & "', '" & ML_TERMS_DESC & "', 'PASTE', 'kgs', " & priceStr & ");"
datafile.WriteLine updStr

 
Hello ebase,

Let s be the output string, do this before using s:
s=replace(replace(s,chr(13),""),chr(10),"")

regards - tsuji
 
Anyway, it would be easer if the code populating newStr was posted too, as I guess priceStr is the culprit.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
here is the code populating priceStr

Dim myArray, eachLine

newStr = trim(eachLine)

priceStr = Right(newStr, Len(newStr) - 6)

thanks!
 
Anyway, it would be easer if the code populating [highlight]newStr[/highlight] was posted too, as I guess priceStr is the culprit

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Oops, sorry. The only thing I could find is:

Dim testStr, testStr2, newStr

thanks again.
 
Got it:
newStr = trim(eachLine)

And now, where come eachLine from ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PHV, I really appreciate the help.

The only thing I could find in the file with eachLine is:

'Format SQL Data
Dim myArray, eachLine

Sorry I can't explain it in detail. From what I know, this is being called from a customized button within MAS90. In MAS90, they print dta to a file which is the first few lines of an SQL query (The INSERT and VALUES). Then when this is called, it adds another line of an SQL query that I posted in the first post into the file.

Thanks!
 
Try to replace this:
priceStr = Right(newStr, Len(newStr) - 6)
By this:
priceStr = Mid(Left(newStr, Len(newStr) - 1), 7)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
THANKS PHV!

You fixed it. You don't know how much I appreciate this!

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top