create a new column using ampersand (1 Viewer)

Jacob Mathai

Registered User.
Local time
Today, 16:05
Joined
Sep 6, 2001
Messages
546
I want to create a new column by using ampersand with 2 existing columns in a query. I want to maintain a constant width for the new column.

For example: (varA and varB are 2 existing columns.)

varA varB

July xyz
August abcd

When I concatenate Using a query, I get this for the new column:

Julyxyz
Augustabcd


My new column data should be like this:

July xyz
August abcd

I tried the format command. That did not work. Somehow, I have to assign a fixed width to the existing columns. I do not know how to.

Any help will be appreciated.
 

SOS

Registered Lunatic
Local time
Today, 08:05
Joined
Aug 27, 2008
Messages
3,514
Well, you aren't going to necessarily get a good fixed width but you can use

MyNewFieldName: [Field1] & " " & [Field2]

or with a tab in place:

MyNewFieldName: [Field1] & Chr(9) & [Field2]

or with set spaces:

MyNewFieldName: [Field1] & Space(10) & [Field2]

or to try to get a consistent one

MyNewFieldName: [Field1] & Space(50 - Len([Field1])) & [Field2]
 
Last edited:

Jacob Mathai

Registered User.
Local time
Today, 16:05
Joined
Sep 6, 2001
Messages
546
Thanks for the quick reply. I will try what you suggested.
 

Users who are viewing this thread

Top Bottom