problem with right function

# Thread: problem with right function

1. Senior Member
Join Date
Dec 1969
Posts
412

## problem with right function

I&#039;ve got this code.<BR><BR>startingNumber = right("00000000" & rsID("PeopleID"),9)<BR><BR>When I print out rsID("PeopleID") I get the value of 1, but when I print out the value of startingNumber, I get an empty string. Anyone know why it would be doing this? Thanks.

2. Senior Member
Join Date
Dec 1969
Posts
1,032

## RE: problem with right function

newval = "00000000" + cstr(rsID("PeopleID"))<BR><BR><BR>newnumber = right(newval,9)<BR><BR><BR>

3. Senior Member
Join Date
Dec 1969
Posts
2,092

## RE: problem with right function

Let&#039;s give numbers to rsID("PeopleID") ok!<BR><BR>Assuming rsID("PeopleID") is equal to:<BR>0<BR>null<BR>10215<BR>598<BR>34<BR><BR>STEP 1<BR>You make a concatenation of 0&#039;s and the value inside rsID("PeopleID") so with the numbers above the result should be:<BR><BR>0<BR>10215<BR>598<BR>34<BR><BR>00000000 0<BR>0000000010215<BR>00000000598<BR>0000000034<BR ><BR>STEP 2<BR>You then use the Right() function, which returns all the data to the RIGHT of the 9th character (because of Right(...,9))<BR><BR>So <BR>000000000<BR>0000000010215<BR>00000000598<BR>0 000000034<BR><BR>Right(000000000, 9) ==&#062; empty<BR>Right(0000000010215, 9) ==&#062; 0215<BR>Right(00000000598, 9) ==&#062; 98<BR>Right(0000000034, 9) ==&#062; 4

4. Senior Member
Join Date
Dec 1969
Posts
412

## RE: problem with right function

Right does not return all data past the 9th character. It starts at the end of the string and gets the last 9 characters of the string. I figured out that I had to trim because right and left add an empty space to the string which caused the problem.

5. Senior Member
Join Date
Dec 1969
Posts
2,092

## LOL you are Right()

My mistake!!!<BR><BR>I hate Monday mornings :-)

6. Senior Member
Join Date
Dec 1969
Posts
973

## RE: Hey Vince

Two wrongs don&#039;t make a right, but three lefts do!!.LOL<BR>Sounds like if you need a cup of black coffee.<BR><BR>Paulee

7. Senior Member
Join Date
Dec 1969
Posts
1,032

## yeah , theres one on your left , or is it Ur right

.

8. Senior Member
Join Date
Dec 1969
Posts
2,092

## Unfortunately

or fortunately for me, I dont drink coffee :)<BR>I only have one bad habit and that is smoking.<BR><BR>Although I heard that a smoke and a cup of coffee was good!<BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•