Hello!
I have a subform to edit items from table [Items] in which multiple items from table [Persons] can be selected in a combobox called cboNameSelect. The subform also includes a command button that opens a form to enter a new item into the [Persons] table if that person is not yet in the database. I have it set up so persons that are already selected earlier in the subform will not appear in the combobox if they have already been selected earlier in the subform. A problem came up with a few test records: some items end up having several hundred persons associated with them, and if the user may searches for a name in the combobox that is already selected, they may end up adding names into the [Persons] table that already exist. I don't want the user to have to scroll back up through the subform to find a name before entering it, so I want to make this easier.
I'd like to do something along the lines of
Me.cboNameSelect = "[already selected item]"
MsgBox "Person already selected."
Me.cboNameSelect.undo
But I can't figure out how to code it so that it will check all the already selected [Persons] from cboNameSelect that appear on the subform.
Bonus points if you can help me figure out how to make the already selected persons appear in grey text instead of black.
I have a subform to edit items from table [Items] in which multiple items from table [Persons] can be selected in a combobox called cboNameSelect. The subform also includes a command button that opens a form to enter a new item into the [Persons] table if that person is not yet in the database. I have it set up so persons that are already selected earlier in the subform will not appear in the combobox if they have already been selected earlier in the subform. A problem came up with a few test records: some items end up having several hundred persons associated with them, and if the user may searches for a name in the combobox that is already selected, they may end up adding names into the [Persons] table that already exist. I don't want the user to have to scroll back up through the subform to find a name before entering it, so I want to make this easier.
I'd like to do something along the lines of
Me.cboNameSelect = "[already selected item]"
MsgBox "Person already selected."
Me.cboNameSelect.undo
But I can't figure out how to code it so that it will check all the already selected [Persons] from cboNameSelect that appear on the subform.
Bonus points if you can help me figure out how to make the already selected persons appear in grey text instead of black.