Disable items already selected on a continuous subform (1 Viewer)

mikenyby

Member
Local time
Today, 04:55
Joined
Mar 30, 2022
Messages
87
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.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:55
Joined
Oct 29, 2018
Messages
21,473
Bonus points if you can help me figure out how to make the already selected persons appear in grey text instead of black.
Try Conditional Formatting.
 

mikenyby

Member
Local time
Today, 04:55
Joined
Mar 30, 2022
Messages
87
Try Conditional Formatting.
Thanks, I've been twiddling around with conditional formatting already, my issue is that I don't know what terms I should use in an expression to identify items that have already been selected in the subform. I imagine it will be something along the lines of Forms!SubFrmEditAssociatedPerson!cboNameSelect! but from there I'm lost.
 

Users who are viewing this thread

Top Bottom