none
how to make a combobox item non-selectable in a access form with VBA RRS feed

  • Question

  • Hi all,

    In a access 2007 form I want to make one or two items of a ComboxBox non-selectable.

    With the BeforeUpdate event I can validate but not avoid the user to select.

    TIA

    João

    Sunday, June 24, 2012 10:44 AM

Answers

  • As far as I know, it is not possible to disable individual items in a combo box.

    The only workarounds I can think of are

    • Use the Before Update event of the combo box, as you're doing now.
    • Use the Validation Rule property (in combination with the Validation Text property); you could set it to
      <>"Item1" And <>"Item2"
      The Validation Text will be displayed as soon as the user selects Item1 or Item2.
    • Adjust the Row Source of the combo box (dynamically if necessary) to omit the item(s) that shouldn't be selected.

    Regards, Hans Vogelaar

    Sunday, June 24, 2012 11:06 AM

All replies

  • As far as I know, it is not possible to disable individual items in a combo box.

    The only workarounds I can think of are

    • Use the Before Update event of the combo box, as you're doing now.
    • Use the Validation Rule property (in combination with the Validation Text property); you could set it to
      <>"Item1" And <>"Item2"
      The Validation Text will be displayed as soon as the user selects Item1 or Item2.
    • Adjust the Row Source of the combo box (dynamically if necessary) to omit the item(s) that shouldn't be selected.

    Regards, Hans Vogelaar

    Sunday, June 24, 2012 11:06 AM
  • Ok,

    the Before Update it's what I had implemented.

    My users are a pain i..... (Ivd propose two combos)  Like this it's good enough.

    Thanks for reply, I won't lose no more time looking for it.

    João

    Sunday, June 24, 2012 2:42 PM