Results 1 to 4 of 4
  1. #1
    Senate is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Jan 2016
    Posts
    15

    Format text inside a Listbox

    Hi

    I searched the web for some time now and can't find a solution, maybe someone here might be able to help.



    I have a Listbox in my form and want to format the entries like 00-0000-00.
    If the entries only contain numbers, this is working like a charm by using this as Row Source
    SELECT [tblBase].[ID], Format([tblBase].[Ate],"00-0000-00") FROM tblBase ORDER BY [Ate];

    The problem is that these entries might also contain letters. I already tried the placeholders I could think of but can't get it to work properly.

    Someone's got an idea?

  2. #2
    moke123's Avatar
    moke123 is online now Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,643
    The problem is that these entries might also contain letters. I already tried the placeholders I could think of but can't get it to work properly.
    Did you try string placeholders? (& and @)
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    The problem is that these entries might also contain letters.
    So that means your Ate field is text so as moke suggests, use the @ or & character

    ?format("12ASB456","@@-@@@@-@@")
    12-ASB4-56

    ?format("AB123456","@@-@@@@-@@")
    AB-1234-56



    ?format("12345678","@@-@@@@-@@")
    12-3456-78

    ?format("AB345678","&&-&&&&-&&")
    AB-3456-78

  4. #4
    Senate is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Jan 2016
    Posts
    15
    Omg yes this was it.

    Should have thought of that one but didn't.

    Thank you very much

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

Similar Threads

  1. How to change date format inside a text field?
    By johnrohan in forum Access
    Replies: 3
    Last Post: 08-21-2017, 12:59 PM
  2. Replies: 6
    Last Post: 04-19-2015, 07:36 AM
  3. Formula and Text inside a Text box
    By trident in forum Forms
    Replies: 1
    Last Post: 04-18-2015, 02:38 AM
  4. How to vertically align text inside a text box ?
    By alexcalgary in forum Forms
    Replies: 2
    Last Post: 10-06-2010, 08:44 AM
  5. Replies: 0
    Last Post: 12-14-2009, 09:57 PM

Tags for this Thread

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