Hi there,
I had some really great help a while back for a script problem i had, but it's giving me some weird results... this is the original question..
"I've got an activex script that emails orders out to suppliers. They need to receive the data in a particular format - and need some field lengths to be a particular size... the problem i'm having is if i use this code....
elseif x.name = "title" then
strLine= strLine & chr(34) & left(x.value,4) & chr(34) & chr(44)
and the title field is nchar then i get a field entry of "MR ", (which is right) but if the title field is varchar i get "MR", (which is wrong)
Does anyone know how why this happens or if I can get around it without changing all my database fields?"
and answer...
"Varchar means the field content is just as long as the data you enter. In any event you can change your script to fix it:
strLine= strLine & chr(34) & left(x.value & " ",4) & chr(34) & chr(44)"
Now what is happening occasionally is if a field has very little data in it - say a 2 digit personalised car number plate 'W1' - rather than the expected say 8 characters, and my code wants to pull out a constant 10 digits and says
strLine= strLine & chr(34) & left(x.value & " ",10) & chr(34) & chr(44)"
then i'm getting say only 7 or 8 digits coming through so "W1 " for example instead of "W1 "
Its working fine apart from those times when the data is much smaller than the field would normally have.
Any thoughts or ideas gratefully accepted
I had some really great help a while back for a script problem i had, but it's giving me some weird results... this is the original question..
"I've got an activex script that emails orders out to suppliers. They need to receive the data in a particular format - and need some field lengths to be a particular size... the problem i'm having is if i use this code....
elseif x.name = "title" then
strLine= strLine & chr(34) & left(x.value,4) & chr(34) & chr(44)
and the title field is nchar then i get a field entry of "MR ", (which is right) but if the title field is varchar i get "MR", (which is wrong)
Does anyone know how why this happens or if I can get around it without changing all my database fields?"
and answer...
"Varchar means the field content is just as long as the data you enter. In any event you can change your script to fix it:
strLine= strLine & chr(34) & left(x.value & " ",4) & chr(34) & chr(44)"
Now what is happening occasionally is if a field has very little data in it - say a 2 digit personalised car number plate 'W1' - rather than the expected say 8 characters, and my code wants to pull out a constant 10 digits and says
strLine= strLine & chr(34) & left(x.value & " ",10) & chr(34) & chr(44)"
then i'm getting say only 7 or 8 digits coming through so "W1 " for example instead of "W1 "
Its working fine apart from those times when the data is much smaller than the field would normally have.
Any thoughts or ideas gratefully accepted