Aligning output using spaces (1 Viewer)

Abes

New member
Local time
Today, 16:07
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, 07:07
Joined
Oct 29, 2018
Messages
21,357
Are you using a fixed width font like Courier?
 

isladogs

MVP / VIP
Local time
Today, 14:07
Joined
Jan 14, 2017
Messages
18,186
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, 22:07
Joined
May 7, 2009
Messages
19,169
or you can put the initial in another textbox.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:07
Joined
May 7, 2009
Messages
19,169
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, 22:07
Joined
May 7, 2009
Messages
19,169
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: 455

Users who are viewing this thread

Top Bottom