Results 1 to 7 of 7
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    Code to right and left justify in one control

    I would like to know if there is a way to justify two parts of a control into separate positions

    if I had all in the same line/control

    Code:
    [person] & " " & [date] & [location]
    So instead of it reading like this

    |John Smith 12/12/2014 Summerhill ____spaces___|

    it would read

    |John Smith 12/12/2014 ____spaces____SummerHill|



    I don't know of any functions that could be wrapped around the fields but that would be helpful....

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,728
    There is a Space() function in Access.

    Suppose [person] is typically 20 chars., [date] is 10 and [location] is 15.
    You could do something like (***untested***)

    [person] & " " & [date] & space(30 - len([location])) & [location]

    Good luck.

  3. #3
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by orange View Post
    There is a Space() function in Access.

    Suppose [person] is typically 20 chars., [date] is 10 and [location] is 15.
    You could do something like (***untested***)

    [person] & " " & [date] & space(30 - len([location])) & [location]

    Good luck.
    I could calculate the whole length and minus all three fields as each will be different.

    I'll see how it turns out

    Thanks

  4. #4
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Hey it's working however how can I find out the exact amount of spaces in a control?

  5. #5
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    I'm using
    Code:
    =Trim([ShowName]) & Space((100-Len(Trim([showname])))-Len(Trim([blurb]))) & Trim([blurb])
    in the control of the report field but it gives me random results - does this mean it does a one size fits all for the report or can each different row have it's own spacing?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,943
    Probably won't get the effect you want with proportional fonts. Try Consolas.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    Probably won't get the effect you want with proportional fonts. Try Consolas.
    I thought it might be that (non monospaced font) :-/

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

Similar Threads

  1. Is there a way to Justify text vs. Distribute?
    By djrickel in forum Reports
    Replies: 2
    Last Post: 03-07-2014, 07:52 PM
  2. Concatenate and Justify
    By libraccess in forum Forms
    Replies: 1
    Last Post: 03-03-2013, 03:39 PM
  3. Replies: 4
    Last Post: 02-09-2013, 09:26 AM
  4. Replies: 3
    Last Post: 11-02-2012, 04:19 PM
  5. Replies: 3
    Last Post: 02-02-2011, 01:00 PM

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