Restrict user selection in combo box

scheeps

Registered User.
Local time
Tomorrow, 02:06
Joined
Mar 10, 2011
Messages
82
Is there a way to restrict a user's selection to only some values in a combo box?

Automatic - Initial
Manual - Corrected
Automatic - Validated
Manual - Validation Error
Automatic - Final
Manual - Deleted ODS
Automatic - Deleted Final

The user needs to be able to select all the manual values, and the automatic values should just be populated as they are handles by other processes.

In other words, only the manual values should be available for selection while the automatic ones should be visible but not be available for user selection.

Hope you guys will be able to help and that my explanation is clear enough.
 
I would use the after update event of the combo box to perform field level validation. You set Cancel = True to stop the update.
 
So to expand on what Boyd mentioned, if the first (and bound) column of the combo box holds Automatic and Manual as its values, then you can just check against the Value or Column(0) of the combo box when validating.
 
Thanks guys. I've implemented this solution and it works perfectly:

Private Sub cboDataStatus_AfterUpdate()

If Me!cboDataStatus.Value = "Initial" Or Me!cboDataStatus.Value = "Validated" Or Me!cboDataStatus.Value = "Final" Or Me!cboDataStatus.Value = "Deleted Final" Then
MsgBox "Please only select 'Corrected', 'Validation Error' or 'Deleted ODS'.", vbOKOnly, "Data Status"

End If
Me!cboDataStatus.Value = "Corrected"

End Sub
 
You're welcome.

Glad we could assist.

PS: If you think we deserve it, you could click the Thanks in the upper right of a post.
 

Users who are viewing this thread

Back
Top Bottom