CHR

G

Guest

I'm trying to create a list in email with some headers on it. The DESCRIPTION
of an item varies from 15 to a max of 25 characters. Is there a way to fill
the gap if a description is less than 25 using the CHR function. Example will
be if the length is only 10 Characters I want to fill the remaining 15
characters with spaces so the next field will be under the right column. I'm
planning to do it this way but for some reason i get an error
strMSG = strMSG & rstObjects![dscp] & Chr(160, 25 - Len(rstObjects![dscp]))
Thanks
 
D

Dirk Goldgar

mmmbl said:
I'm trying to create a list in email with some headers on it. The
DESCRIPTION of an item varies from 15 to a max of 25 characters. Is
there a way to fill the gap if a description is less than 25 using
the CHR function. Example will be if the length is only 10 Characters
I want to fill the remaining 15 characters with spaces so the next
field will be under the right column. I'm planning to do it this way
but for some reason i get an error
strMSG = strMSG & rstObjects![dscp] & Chr(160, 25 -
Len(rstObjects![dscp])) Thanks

It's not the Chr() function you need to use, it's the String() function:

strMSG = strMSG & rstObjects![dscp] & _
String(25 - Len(rstObjects![dscp]), 160)
 
G

Guest

Thank you... I tried to make it work with space(x-y) too.

Dirk Goldgar said:
mmmbl said:
I'm trying to create a list in email with some headers on it. The
DESCRIPTION of an item varies from 15 to a max of 25 characters. Is
there a way to fill the gap if a description is less than 25 using
the CHR function. Example will be if the length is only 10 Characters
I want to fill the remaining 15 characters with spaces so the next
field will be under the right column. I'm planning to do it this way
but for some reason i get an error
strMSG = strMSG & rstObjects![dscp] & Chr(160, 25 -
Len(rstObjects![dscp])) Thanks

It's not the Chr() function you need to use, it's the String() function:

strMSG = strMSG & rstObjects![dscp] & _
String(25 - Len(rstObjects![dscp]), 160)

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
D

Dirk Goldgar

mmmbl said:
Thank you... I tried to make it work with space(x-y) too.

I'm not sure if this means it's working now or not. I believe what I
posted should have worked, so please let me know if you're still having
a problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top