Try
DoInsertQuery("If Not Exists(" & _
"SELECT * FROM tblSchoolYear " & _
"WHERE schoolYear = 'SY " & Trim(txtAddSchoolFrom.Text) & "-" & Trim(txtAddSchoolTo.Text) & "')" & _
"INSERT into [tblSchoolYear] ([schoolYear]) VALUES ('SY " & Trim(txtAddSchoolFrom.Text) & "-" & Trim(txtAddSchoolTo.Text) & "')")
Catch ex As Exception
MsgBox(ex.Message)
End Try
im having a confusion in the part of "if not exists", i just want to know how to put show mgbox if the query found duplicates
i've searched on google but only found how to check if there are duplicates