I have an application with a combobox. The box is populated on form load. the users have the ability to "add" items to the combobox if the item isn't already on the list. The backend is an MS Access DB and for this table the "duplicates allowed" is set to no. I need a way to check for duplicates before the "insert into" statement runs.
Private Sub cboPt1_LostFocus()
Dim rsc As adodb.Recordset
Dim NewItem As String
Dim ssql As String
NewItem = "ZZ"
ssql = "insert into itemlist"
ssql = ssql & " (itemnmbr, itemdesc, uscatvls_2)" & " "
ssql = ssql & " values('" & cboPt1.Text & "', '" & cboPt1.Text & "', '" & NewItem & "')"