0

I am new to Access VBA.

I am making a simple form which will insert data into the table. The table is as follows.

enter image description here

The form has two textboxes and one save button.

textbox1 = Category Name textbox2 = Item Name

What i want is when the user press the save button, the code should check the duplicate entry comparing both Category and Item Name.

For Example, if the user enters Fruit in Category Textbox and Apple in ItemName textbox, then system should prompt for duplicate entry. However, if the user enters Vegetable in Category Textbox and Apple in ItemName textbox, then system should allow to make entry in table.

Kindly help.

Regards/

Salman Khan
  • 131
  • 1
  • 2
  • 11

1 Answers1

1

I assume you want this behavior regardless of the way you enter data. Then you should create a unique index on those two columns. Check eg. this.

Jörgen R
  • 366
  • 1
  • 10