title: VBA how do I get the sql server error message
body: <p>I am using vba to write in sql server table.</p>
  <p>The table is designed so that if the user tries to insert a line that already exists, the line won't be inserted (primary key constraint + IGNORE_DUP_KEY = ON).</p>
  <p>I want vba to print a message like &quot;your line already exist in the table, it will not be inserted&quot; and then: resume next.</p>
  <p>My problem is that I cannot use an if statement since I cannot get the error number or description from sql.</p>
  <p>Anyone has the answer to this problem?
  thanks</p>