From a form, I have a button that does the following code to import a range from Excel into a specific Access table. I'm trying to figure out how to test to see if the record already exists in the table as to prevent key violation errors from occuring. Any ideas? I'm not sure where to start.
Private Sub imp_supp_info_Click()
If (TEST FOR RECORD EXISTANCE=TRUE) Then
End Sub
Private Sub imp_supp_info_Click()
If (TEST FOR RECORD EXISTANCE=TRUE) Then
MsgBox ("Supplier profile already exists.")
ElseIf txt_file_loc.Value = "" Then
MsgBox ("No file was selected. Import canceled.")
ElseIf txt_file_loc.Value <> "" Then
DoCmd.TransferSpreadsheet, acSpreadsheetTypeExcel9, "ps_supplier_info", txt_file_loc.Value, True, "access_company_info"
MsgBox ("Import of Supplier Profile Complete")
Else
MsgBox ("No file was selected. Import canceled.")
End If
End IfEnd Sub