I'm trying to insert a record if it does not exist in the table. if exits then do nothing.
Code: Select all
strSQL = "INSERT INTO CustomerList ([CU No], [Customer Name],[Contact No]) SELECT '" & Me.txtCUNo.Value & "', '" & Me.TextBox2.Value & "', '" & Me.TextBox3.Value & "' WHERE NOT EXISTS (Select [CU No] From CustomerList WHERE [CU No] ='" & Me.txtCUNo.Value & "') LIMIT 1;"
Any help would be kindly appreciated.