Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    angybab is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Oct 2020
    Posts
    35

    Use Fontbold in a list of combobox

    Hi all,
    I have a list of items in a combobox having two columns. The first column contain the codes (3 and 5 digit codes) the second column contains the text describing the code. I want the rows containing the 3 digit codes to have a Font bold. Is it possible to use a vba code to set that in access?

    lets say; this is the list of contents in the combox "cboMainSubkat" (the list source is from a table)

    code meaning
    A01 Main kategory for all A01's
    A01.2 Sub kategory
    B01 Main kategory for all B01's
    B01.3 Sub kategory



    I want all rows with 3 digit codes to be bold. I will appreciate any help.

    thanks

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,540
    AFAIK that's not possible.

    You might be able to get a similar effect using a hidden subform, a button and a textbox but I think it would take a bit of time and patience. I have a vague recollection of seeing somebody's attempt at this but I have no idea now of when or where that was or even if it worked.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Agree with Bob.
    You can do limited formatting in combo boxes but not what you want.
    To get an idea of what can be done, see http://www.mendipdatasystems.co.uk/a...our/4594424152
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    IIRC a listbox can have such formatting, so you would have to resort to some trickery to make a listbox emulate a combobox along with a button to "drop down" the listbox. However, the list has to be bound to a RTF table field and the text formatted as you wish. I do not believe you can easily make that text formatted on the fly.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    The link in post #3 also covers formatting in listboxes.
    AFAIAA, you cannot do anything significant regarding formatting in a listbox compared to a combobox
    However, happy to be proved wrong ....
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  6. #6
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    However, happy to be proved wrong
    Not much chance of that. Whatever I had that I vaguely recall has been lost as you probably know. Perhaps it was a visual trick that I employed, but I seem to recall that I had what looked like a listbox with multi-coloured fonts. I will have to defer to the conventional wisdom and admit defeat.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Ha!
    This is from the link I gave in post #3:

    Click image for larger version. 

Name:	Capture.PNG 
Views:	32 
Size:	45.0 KB 
ID:	43316

    No trickery. Just formatting of null/not null in the Field2 column - it works for text fields only

    Was that what you were thinking of perchance?
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Not according to how I read OP's question.

    My understanding is they want rows with A01 and B01 to be bold. This goes well beyond Null/NotNull.
    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.

  9. #9
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    Thanks, that must have been it because I did implement that. I didn't follow the link at first because I interpreted your post as being for a combo box.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  10. #10
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    only way is to use a subform using conditional formatting. in combination with a textbox you can use code to make it look and behave like a combo. Note this method is not suitable for continuous forms. It can be done, but is a lot more work.

    Don't have time to provide the code right now but in principle

    in design view, place subform directly below bottom of text box to a width to suit
    in form load event set subform height to 0
    in textbox gotfocus event, set subform height to something appropriate
    in textbox change event apply a 'find' to find the first record that matches what is being typed

    in subform current event populate the parent form textbox with the value selected then reduce the subform height to 0

    and of course in subform set conditional formatting to something like

    expression is....len([CODE])=3

  11. #11
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Quote Originally Posted by June7 View Post
    Not according to how I read OP's question.

    My understanding is they want rows with A01 and B01 to be bold. This goes well beyond Null/NotNull.
    That was exactly the point I made from the start! The formatting that can be done with combos or listboxes isn't what the OP wants
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  12. #12
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Hi everybody!

    I often use simple forms as useful lists and I have to say that is not as hard as it seems to make a form to simulate a drop-down list, but, I think it demands more work to replace it completely.

    I attach a sample project, with two combo boxes in a main form that use the same hidden pop-up form as drop-down list and I think that the results is close to the desired.

    Click image for larger version. 

Name:	PrtSc01.JPG 
Views:	32 
Size:	24.2 KB 
ID:	43318

    Forms give us the ability to create well designed lists with additional information for each item, like images, symbols, conditional formats, hyperlinks etc.

    I hope it helps.

    Cheers,
    John
    Attached Files Attached Files

  13. #13
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    Sure OP, who is not one of the last 11 posters, said bold. Sometimes when you present options they are deemed acceptable. I wouldn't get too hung up on pointing out what OP wants based on one post and no follow up.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  14. #14
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    @accesstos, sample db was driving me nuts trying to understand what was happening until I caught your description this uses a popup form. Really becomes obvious after switching to Overlapping Windows which is my usual preference. Had to make adjustment to the Left and Top calculations for popup form placement.
    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.

  15. #15
    angybab is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Oct 2020
    Posts
    35
    This seems to be a very complicated issue

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 08-13-2020, 02:47 PM
  2. ComboBox List
    By Daisy509th in forum Forms
    Replies: 19
    Last Post: 03-22-2018, 07:13 PM
  3. Update Combobox List from another value
    By Joakim N in forum Access
    Replies: 7
    Last Post: 10-12-2016, 11:19 AM
  4. Conditional FontBold based on other control
    By abusaif in forum Access
    Replies: 1
    Last Post: 07-28-2016, 05:27 AM
  5. Change Combobox list after use it
    By TesZero in forum Programming
    Replies: 4
    Last Post: 07-22-2014, 02:14 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