Checking List Box Value with Combo box selection

empyrean

Registered User.
Local time
Yesterday, 20:37
Joined
Oct 20, 2009
Messages
17
Hi

I have a combo box with some values, when i select the data in the box it should check with the data present in the list box if it did not find its duplicate then the list box should take this value and if it finds the value if should pop up a msg box saying duplicate value found. The list box contain two colums and it should check with first column

Can anyone help me in this?

I am using these in access 2003 and VB
 
I tried this but still not working



Private Sub CommandResult_Click()
Dim varItm As Variant
Dim duplicate As Boolean

Dim intY As Long

'~~> Loop through List
For intY = 0 To ListAliasInformation.ListCount - 1
'~~> Check if Combo Value exists in list
If ListAliasInformation.ItemData(intY) = ComboCheck.Value Then
'~~> If found, Inform User
MsgBox ComboCheck.Value & " Already Exits in list"
duplicate = True
Exit Sub

End If
Next intY
'~~> Add Item to List
' ListAliasInformation.AddItem ComboCheck.Value

If Not duplicate Then
Me.ListAliasInformation.AddItem (Me.ComboCheck.Value & ";" & Me.ListAlias.Value)
End If
End Sub
 
What is not working? I have just tested your code and it works for me....
 

Users who are viewing this thread

Back
Top Bottom