Best way to show list with only some items selectable?

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

I am trying to build a pick list of items that have criteria for selection -
but I don't want to hide the items that don't meet the criteria

eg list of:

Apples Fruit
Oranges Fruit
Potatoes Vegetable
Pears Fruit



The rule I want is "allow user to select Fruits but not vegetables"
Selecting a row then executes more code based on the selection.


Listboxes and Combos don't allow me to disable rows so I thought about a
datasheet view subform but I am unsure how to proceed.

Any ideas?

Thanks

Bill
 
Bill

So you want to list the Potatoes, but not allow them to be selected?

Are you working in a listbox or a combobox? I suppose one approach might be
to add code to the mousedown event that evaluates the selection and
unselects if type=vegetable.

This would be confusing to your users, though, since in Windows, if it isn't
greyed out, you can select it. How will your users react to seeing it but
not being able to select it?
 
Correct.
I want to show the whole list but display the potato line differently - ie
greyed out
I would prefer to use a listbox but there seems to be no way to format
particular rows.

Your unselecting the selection approach would work if I could visually
differentiate potatoes first.

Bill
 
Your table should have a field like ItemTypeID where you define each item as
Fruit or Vegetable. Say ItemTypeID is 1 for Fruit and 2 for Vegetable. Use a
continuous form for your list and include the ItemTypeID field. Make it Not
Visible. In the ItemName field use Conditional Formatting with an expression
like:
[ItemTypeID] = 2
and conditionally format the ItemName field to be disabled. You will now see
all items in the list but all Vegetables will be disabled and you will not
be able to select a Vegetable.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com

If you don't get the help you need in the newsgroup, I can help you for a
very reasonable fee. Over 1000 Access users have come to me for help.
 
Bill

You may have some luck at Lebans' website, as he has many "formatting" fixes
available. I don't know if one of them handles formatting of listbox rows.

As Steve (PC) points out, a "list" could be a continuous form. I don't know
if that meets your need to select and then do something with selected items.

Regards

Jeff Boyce
<Office/Access MVP>
 
PC/Steve

It's considered ill-mannered to advertise your services in these public
newsgroups.

You may not feel there's anything wrong with offering to help for a fee, but
consider ... if everyone who responds to a request for help did so, the
newsgroup could degenerate into a used-car lot like atmosphere, with
everyone trying to "make the sale".

Thanks for offering a potential solution first.

Regards

Jeff Boyce
<Office/Access MVP>

PC Datasheet said:
Your table should have a field like ItemTypeID where you define each item as
Fruit or Vegetable. Say ItemTypeID is 1 for Fruit and 2 for Vegetable. Use a
continuous form for your list and include the ItemTypeID field. Make it Not
Visible. In the ItemName field use Conditional Formatting with an expression
like:
[ItemTypeID] = 2
and conditionally format the ItemName field to be disabled. You will now see
all items in the list but all Vegetables will be disabled and you will not
be able to select a Vegetable.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com

If you don't get the help you need in the newsgroup, I can help you for a
very reasonable fee. Over 1000 Access users have come to me for help.



Bill said:
I am trying to build a pick list of items that have criteria for
selection - but I don't want to hide the items that don't meet the criteria

eg list of:

Apples Fruit
Oranges Fruit
Potatoes Vegetable
Pears Fruit



The rule I want is "allow user to select Fruits but not vegetables"
Selecting a row then executes more code based on the selection.


Listboxes and Combos don't allow me to disable rows so I thought about a
datasheet view subform but I am unsure how to proceed.

Any ideas?

Thanks

Bill
 
Back
Top