locked
Change Font in List Box! RRS feed

  • Question

  • Is it possible if one field is true that the font in that record of the list box

    Something like I have on my report?

    If Me.tbFlag = -1 Then
                Me.tbInvoiceDate.FontWeight = conBold
                Me.tbInvoiceDate.FontSize = 8

    Thanks for any help.....Bob

    Saturday, May 21, 2011 11:30 PM

Answers

  • Can't test that on this computer.  I have to say that I am surprised that you can have a different font or other characteristics for different rows in a listbox. 

    I know you can change the font characteristics for the ENTIRE listbox at any time, but was never able to do it in Access 2003 and earlier versions and I have never tried in 2007 or 2010.


    John Spencer Access MVP 2002-2005, 2007-2011 The Hilltop Institute University of Maryland Baltimore County
    • Marked as answer by TurnipOrange Thursday, May 26, 2011 10:30 PM
    Sunday, May 22, 2011 6:43 PM

All replies

  • It is possible to do this, On the On Current event of your Form, place this:

    If Me.tbFlag = -1 Then
                Me.tbInvoiceDate.FontBold = True
                Me.tbInvoiceDate.FontSize = 8

    End If

     

    When tbFlag = True then the tbInvoiceDate will be Bold and with FontSize 8.

     

    HTH,

     


    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
    Sunday, May 22, 2011 12:47 AM
  • As far as I know, you cannot do this in a listbox control.  Listbox controls and combobox controls have one font, one font size, etc.  for all the rows and columns.

    If you really need to do this, you could use a subform to mimic a listbox and then use conditional formatting to control the fontweight, fontsize, etc. in individual controls.

    The subform can emulate a listbox with the exception that it cannot the emulate multi-select option and you will need code to get the value of the "bound" column.


    John Spencer Access MVP 2002-2005, 2007-2011 The Hilltop Institute University of Maryland Baltimore County
    • Proposed as answer by Bruce Song Thursday, May 26, 2011 12:01 PM
    Sunday, May 22, 2011 3:58 PM
  • Hi John,

     

    It is possible, I did a test in Access 2007 with a Listbox, and it works like a charm.

     


    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
    Sunday, May 22, 2011 4:29 PM
  • Can't test that on this computer.  I have to say that I am surprised that you can have a different font or other characteristics for different rows in a listbox. 

    I know you can change the font characteristics for the ENTIRE listbox at any time, but was never able to do it in Access 2003 and earlier versions and I have never tried in 2007 or 2010.


    John Spencer Access MVP 2002-2005, 2007-2011 The Hilltop Institute University of Maryland Baltimore County
    • Marked as answer by TurnipOrange Thursday, May 26, 2011 10:30 PM
    Sunday, May 22, 2011 6:43 PM
  • Hello,

    I have to agree with John that there is no way to change font properties for a single item in the list box control.

    Nadia

     

    Sunday, May 22, 2011 7:03 PM
  • Thanks Guys I didnt think I could change individual records in a list box

    Regards Bob

    Sunday, May 22, 2011 11:23 PM
  • Yup agreed, not for a single item ... I thought OP wants for entire listbox.

     


    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
    Monday, May 23, 2011 5:23 AM