Padding string

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

Is there a way in access 97 to pad a string with spaces such that the
resultant string is always x characters long?

Thanks

Regards
 
How about using string concatenation, like...

Dim M As String (or M$)
M = Right(" " & "ABC",5)

"ABC" could also be a textbox...

In this case, M would result in " ABC"...

HTH - Bob
 
John wrote in message said:
Hi

Is there a way in access 97 to pad a string with spaces such that the
resultant string is always x characters long?

Thanks

Regards

I think the String function exists a97. Say you have a variable strTest
containint "hello"

strNewWar = strTest & String(20 - len(strTest), "@")

I think also the LSet statement could be used

strNewWar = "12345678901234567890"
LSet strNewWar = strTest
 

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

Back
Top