Hello,
I import data into a temp table and then run an Update query (below) to add data to the accrual table. I want to display a custom message instead of "Primary key violation error" if the user tries to import the same file twice and terminate the program. The "run_name" is the primary key.
Is there a way to trap the error message and changes it to a custom message?
Thanks
I import data into a temp table and then run an Update query (below) to add data to the accrual table. I want to display a custom message instead of "Primary key violation error" if the user tries to import the same file twice and terminate the program. The "run_name" is the primary key.
Is there a way to trap the error message and changes it to a custom message?
Code:
SQL = "INSERT INTO tbl_Projects ( run_name, run_date )"
SQL = SQL & " SELECT DISTINCT tbl_Variants_temp.run_name, tbl_Variants_temp.run_date"
SQL = SQL & " FROM tbl_Variants_temp"
Debug.Print SQL
db.Execute SQL, dbFailOnError
Thanks