Help on Duplicate Record in VB6

Submitted by zev0725 on
I have a problem with my database and ComboBox. On my database I put Indexed: No Duplicate in one of my fields and on my comboboxlist I put numbers from 1 to 15 so it will error when i duplicate a data. And this is my code:
  1. If Combo1.CausesValidation = false Then
  2. MsgBox "The Room is already Occupied. Please find another room.", vbInformation
  3. Else
  4. Adodc1.Recordset.Update
  5. MsgBox "Record Saved.", vbInformation
  6. frmMain.Show
  7. End If
I dont know if this is right but, what I want to happen is when i saved a new entry it will save and when I enter a duplicate data, there will be a pop up msg that saying "the room is already occupied". please help. Ill show an image Image