Right-Align Field When Exporting to Text

J

JimmieL

Is there an easier equivalent to the "xg_lPad" function in ACCESS 2007" to
right-align text in a field when doing a query? That function worked with
ACCESS 2003, but does not work when using ACCESS 2007 with the 2003 database.
 
C

Clifford Bass via AccessMonster.com

Hi Jimmie,

If there are never nulls or zero-length strings in your fields, you
could do something like:

Format("right-justify me", "@@@@@@@@@@@@@@@@@@@@@@@@@")

If there can be nulls or zero-length strings you could use something
like the following:

Right(Space(25) & "Right-justify me!", 25)

Or you could put it into your own function in a standard (not class, not
report, not form) module:

Public Function RightJustify(ByVal varValue As Variant, intLength As Integer)
As String

RightJustify = Right(Space(intLength) & varValue, intLength)

End Function

Then you could use:

RightJustify("Right-justify me!", 25)

Clifford Bass
 

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