Results 1 to 6 of 6
  1. #1
    emhill57 is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    May 2017
    Posts
    27

    Selecting Different Value from Select List


    I have a select list that is retrieving its entries from a field that is 4 characters, right-justified. I want to somehow display the entries with the leading blanks trimmed but when the selection is made, I need the returned value to be right-justified so it will filter correctly. I know I can use the TRIM() function if my query to get the values in my select list but how would I return them right-justified?

    Thanks in advance!!!!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    use a form. Set the text box to right just.

  3. #3
    emhill57 is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    May 2017
    Posts
    27
    The list box is in a form. I want it to display with NO leading blanks but when it is selected I need it to "pass" the selection as right justified because I have some VBA code on the AfterUpdate event of the select box. I use the selection as part of a filter string against a database and it needs to be 4 characters right-justified to compare to the field in the table.

    Hope this explains it a little better that I did to begin with.

    Thanks!

  4. #4
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Use a two-column list box, with a query that selects the same fields twice from the source table, once with the leading blanks, the second without. Make the column with the leading blanks the first column, and make its width zero so that it does not display. Set the bound column of the list box to 1 (the one with the blanks); that is the value the VBA wil use.

  5. #5
    emhill57 is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    May 2017
    Posts
    27
    Thanks John_G!!! I'll give that a whirl!

  6. #6
    emhill57 is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    May 2017
    Posts
    27
    John_G... That worked!!! Thanks so much!!! This novice is gaining knowledge everyday!!!

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

Similar Threads

  1. Selecting Just One List Box
    By Khatru in forum Forms
    Replies: 1
    Last Post: 03-30-2015, 12:01 PM
  2. Replies: 15
    Last Post: 11-20-2013, 04:30 PM
  3. Selecting items in multi-select list box
    By chronister in forum Access
    Replies: 3
    Last Post: 08-25-2013, 03:33 AM
  4. Replies: 5
    Last Post: 08-02-2012, 09:44 AM
  5. Replies: 1
    Last Post: 10-22-2010, 10:11 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