Need function to left justify and pad spaces in query

W

whiterhino

Hi,
I have a table with data like these two columns...

Name State
John WA

I would like to use an Access query function or create a funtion i
Access to allow me to create a query with output like this

"John WA "

When I post my example above, the spaces are stripped away but I woul
like to see the Name data left justified and padded to a total of 2
spaces including the data, and the State data left justified and padde
to a total of 10 spaces including the data. Both columns of data are i
a single string like shown above.

Ideally, I would like to use this function in the query object, but vb
is an option also.

Thanks in Advance
 
V

Van T. Dinh

Left([Name] & Space$(20), 20) & Left([State] & Space$(10), 10)

should do

Note: "Name" is a bad name for Field name. Most objects in Access (if not
all objects) have the Property "Name" and it is easy to get confused
between the Property "Name" and the Field / Field value "Name".

HTH
Van T. Dinh
MVP (Access)
 
Top