Duplicate values - Combo Boxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Scenario. I have a form that has 20 combo boxes.
How Do I initiate code that will prevent users from making duplicate
selections from the combo boxes.
 
Hi Olu,

Do you mean that you have 20 unbound combo boxes and no two of them should
have the same value?

If so, there are various approaches to writing code that would perform this
check - but before setting about writing it I suggest you re-think the user
interface: there's almost certainly a neater way of doing it (e.g. a
multi-select listbox, or a single combo box in which to make selections,
accompanied by a listbox that displays them).
 
You are absolutely right. I was just looking at some sample databases that
have something similar. I am using a combo box, and listbox method. where I
populate the listbox based on the afterupdate event of the combo box. however
I still have two problems, how to remove an item from the list box, and als
need some help in ensuring that duplicate values are not entered into the
listbox.
 
I now need some assistance in adding a selection from my combo box to my
listbox.
I tried the following Code but got an error -
(The expression After Update you entered as the event property setting
produced the following error: a problem occured while Microsoft Access was
communicating with the OLE Server or Active X Control.)

Here is my code sample;
Private Sub cboControl_AfterUpdate()
Dim strSQL As String
strSQL = "SELECT DISTINCT ControlNumber FROM tblSopNumbers " & "" &
cboControl
strSQL = strSQL & " ORDER BY ControlNumber;"
lstControlNumbers.RowSource = strSQL
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top