Results 1 to 3 of 3
  1. #1
    CoachBarker is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    17

    Formatting a Concatenated Field


    I have a query in my Access DB that I am using as a field in a vb.net program. Is there a way I can format the field in the query so all spacing is equal?
    example:
    I would like;
    RN - W.Barker 1.0
    RN - S.Barker 1.0
    RN - J.Smith .8
    NM - M.Moorehouse 1.0

    instead of;
    RN - W.Barker 1.0
    RN - S.Barker 1.0
    RN - J.Smith .8
    NM - M.Moorehouse 1.0

    in other words the last column should end up lined up based on the longest name.

    Code:
    SELECT tblEmployee.EmployeeID, tblEmployee.EmpFullName, tblEmployee.EmpStatus, tblEmployee.EmpPosition, [EmpPosition] & "-" & [EmpFullName] & "  " & [EmpStatus] AS ConName
    FROM tblEmployee;
    After the field is used in the vb.net program, it and other fields will be exported to a MS excel file for printing.

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    I didn't see any difference from your two set of results.

    maybe you tried to put spaces in the front to make them line up on the right side?
    if so, you need to know the length of the longest one, suppose it is 50, then

    select right(string(50," ") & [EmpPosition] & "-" & [EmpFullName] & " " & [EmpStatus], 50) AS ConName from ...

  3. #3
    CoachBarker is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    17
    thanks, I didn't notice that the forum formatting took the extra space out of the first set example. Will try what you posted. Thanks again.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Conditional Formatting
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 08-30-2010, 09:31 PM
  2. Need help formatting chart
    By NISMOJim in forum Reports
    Replies: 1
    Last Post: 08-22-2010, 10:02 AM
  3. Formatting a Calculated Field
    By e_lady333 in forum Queries
    Replies: 0
    Last Post: 03-17-2010, 06:11 PM
  4. Sum values in concatenated fields
    By jdrubins in forum Reports
    Replies: 4
    Last Post: 09-01-2009, 07:20 AM
  5. Need Help Formatting a field.
    By marshallgrads in forum Access
    Replies: 4
    Last Post: 12-06-2007, 03:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums