Aligning output using spaces (1 Viewer)

Abes

New member
Local time
Today, 09:30
Joined
Jul 2, 2021
Messages
21
I have the following expression in a query from which my report gets its data.

Code:
Left([points].[member] & Space(30),30) & [initials]

The intention is for the concatenated field to appear on the report as follows:

Smith AB
Jones PJ
Nicholson BR

The initials are meant to align directly below one another, but the expression gives me:

Smith AB
Jones PJ
Nicholson BR

This I have to assume this is due to the variable length of the surnames, and to which spaces are added before we get to the initials part. I need the surname to fit into 30 char max and then the initials should be aligned below one another.

What have I got wrong here or is there a better way to do it?

Thanks in advance.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:30
Joined
Oct 29, 2018
Messages
18,987
Are you using a fixed width font like Courier?
 

isladogs

CID VIP
Local time
Today, 08:30
Joined
Jan 14, 2017
Messages
16,240
As they are separate fields, why concatenate them at all?
Just display as two separate fields and the initials will be perfectly aligned with no additional work and no matter what font you use.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:30
Joined
May 7, 2009
Messages
16,409
or you can put the initial in another textbox.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:30
Joined
May 7, 2009
Messages
16,409
it will Not work, because Calibri font is not Fixed Width (meaning each characters occupy the same width).
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:30
Joined
May 7, 2009
Messages
16,409
it will work, yeah.
but is it presentable with Courier font.
actually you can add a Box to your report and use
any Presentable font. see Report Query1.
 

Attachments

  • paddedString.accdb
    512 KB · Views: 374

Users who are viewing this thread

Top Bottom