hey guys, can you help me? im using a datagridview, and it is connected to ms access. every time i have an input same in the column where primary key is I already got an error. can you guys how to show a messagebox if the Customer Contact number is already in use? here is my code.

Dim amount As Integer
amount = Remaining_bo_es_TextBox.Text - txtOrder.Text
Remaining_bo_es_TextBox.Text = amount
Label5.Text = txtOrder.Text * PriceTextBox1.Text
Label1.Text = Product_NameLabel1.Text
Transactions.TblTransactionsTableAdapter.Insert(Me.txtCustName.Text, Me.txtCustNumber.Text, Me.txtCustEmAdd.Text, Me.Label1.Text, Me.Label5.Text, Today.Date.ToShortDateString)
Label4.Text = "click new transaction"

You will have to check before your INSERT statement if the record exist. This can be done by using the BOF or EOF functions. If any of these are true, the record does not exist and you can add the data, else exit the sub.