Access 2007 - Placing a portion of report text in a particular column

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jim Boyd
    New Member
    • Sep 2008
    • 1

    Access 2007 - Placing a portion of report text in a particular column

    I'm using Access 2007 under Windows XP.

    I'm creating a a multiline directory list for members of a club with three lines for each member.

    Each listing has three textboxes and within the first textbox I have code like:
    =Trim(lastname] &", " & [firstname] ...... & [Telephone]) with more fields where I show the ...... in this example.

    I want the Telephone data to start at a specific column so that all Telephone data lines up. What do I add to insure this?
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    The following code will precisely position the Telephone Numbers at Column 25. I used the [LastName], [FirstName], and [HomePhone] Fields from the Northwind Database for my code demo and will display the SQL along with the subsequent Output. In order for this logic to be effective, you must used a Fixed Width Font in Datasheet View, such as Courier:
    1. SQL
      Code:
      SELECT [LastName] & ", " & [FirstName] & Space$(25-Len([LastName] & ", " & [FirstName])) & [HomePhone] AS [Directory List]
      FROM Employees;
    2. OUTPUT
      Code:
                  Directory List
      Davolio, Nancy           (206) 555-9857
      Fuller, Andrew           (206) 555-9482
      Leverling, Janet         (206) 555-3412
      Peacock, Margaret        (206) 555-8122
      Buchanan, Steven         (741) 555-4848
      Suyama, Michael          (171) 555-7773
      King, Robert             (761) 555-5598
      Callahan, Laura          (206) 555-1189
      Dodsworth, Anne          (741) 555-4444

    Comment

    Working...