Results 1 to 13 of 13
  1. #1
    onlylonely is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2017
    Posts
    110

    Listbox - Center

    Hi Guys,

    Appreciate if you could teach me how to make the "x" to center in the listbox?



    Click image for larger version. 

Name:	form.JPG 
Views:	31 
Size:	53.2 KB 
ID:	30702

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    you don't have any control of positioning in a listbox. Only thing you could so is put some spaces before the x

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I've never needed it, but Stephen Lebans did some neat things:

    http://www.lebans.com/List_Combo.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    you don't have any control of positioning in a listbox
    When the listbox is expanded to choose from you don't, but the resulting text can be centered after the list is closed.

    @OnlyLonely - what is you have shown in your screencap? It doesn't look like a form - it looks more like a report. Whichever it is, in form/report design view you can set the "X" to display centered using "format" on the ribbon.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    @John_G - are you thinking of a combobox?

    I think OP is using listboxes to display data, not for user selection, at least that was my understanding of description in other post.

    'centering' the data will require padding with leading spaces. If the data is text and always the same length, can simply adjust in the listbox RowSource query: " " & [fieldname]

    If data is number can do same or use Format() function, example: Format(Min([RepYear])," 0000")
    Last edited by June7; 10-10-2017 at 01:03 AM.
    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.

  6. #6
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    When the listbox is expanded to choose from you don't
    What do you mean by expanding a listbox? Are you thinking of a combo box?

    Certainly I'd agree that centering in a report or form is simple if the field is a text box or combo (you can easily center the selection in a combo - not so much it's column data). I have to wonder what that image is too since the columns are bordered and there are no horizontal lines. Could be done with a lot of small vertical lines, just long enough and tight enough to create a continuous vertical line. If that's the case, simply move the lines for the x column. Or is this easily done in a report with anything newer than version 2007?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Oops!!

    Mea Culpa All! Yes, I was thinking about a combo. Sorry 'bout that. Next time I'll be more careful.

  8. #8
    onlylonely is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    May 2017
    Posts
    110
    I've found my solution. Is an easy way.
    Go to listbox - property sheet - Allow Value List Edits (Yes) - Go to table and align the "X" to center.

  9. #9
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    I learn something new every day!

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Yep, new one for me. However, if your RowSource is a query, that approach is not available.

    Also, if the table is linked, the setting will not carry over - will have to set it in the frontend link, in spite of the linked table edit warning.
    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.

  11. #11
    gavan is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2023
    Posts
    1
    Simple Solution
    Go to the source table <the list box or combobox source>
    make the text aline in center in the table and save table
    go to your comboobx and see the magic
    thanks

  12. #12
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    6 year old thread?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  13. #13
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Not only that, same answer as given in post 8.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Center text vertically
    By kuku202 in forum Reports
    Replies: 1
    Last Post: 02-07-2015, 05:27 AM
  2. Contact Center DB
    By tduffield89 in forum Database Design
    Replies: 23
    Last Post: 11-19-2013, 03:11 PM
  3. Trust Center Issue
    By bginhb in forum Access
    Replies: 4
    Last Post: 10-22-2011, 03:50 PM
  4. Center Form Vertically
    By injanib in forum Forms
    Replies: 5
    Last Post: 03-24-2011, 01:51 PM
  5. Report will not center on page
    By AKQTS in forum Reports
    Replies: 3
    Last Post: 10-21-2010, 12:36 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