Using Len function on the contents of a variable

aziz rasul

Active member
Local time
Today, 17:02
Joined
Jun 26, 2000
Messages
1,935
In my code I evaluate the number of records in a table and place the value in a variable called Record_Count.

I now wish to attach a string of 0's in front of the Record_Count so that the total number of numbers in x is 10 e.g. 0000158458

Record_Count = 158458
x= String(10 - Len(Record_Count), "0") & Record_Count

However the value of Len(Record_Count) always equals 4! Can anyone suggest how I can change the code so that I obtain the correct length of Record_Count?
 
Hi Aziz,

there's probably a smart answer to do with counting bits or bytes or something, but i don't know what it is. In the mean time why not put record_count into a string and get the length of that instead? It should work okay

HTH

Drew
 
That worked Drew. Many Thanks.

I also tried making Record_Count as a variant and it still worked.
 

Users who are viewing this thread

Back
Top Bottom