[AccessD] Trapping an ODBC error from MS SQL server

rusty.hammond at cpiqpc.com rusty.hammond at cpiqpc.com
Thu Mar 27 17:07:38 CST 2003


I am copying data from a vendor's MS SQL server table to an in-house SQL
server table.  Right now I have a pass-through query setup in A97 to copy
the data after certain other criteria are met.  The vendor table has a
Unique ID field that I am copying.  I have setup the id field on our table
to be unique and to ignore duplicate values.  The problem is I get an ODBC
error each time the query runs then another message telling me the dupicate
values were ignored.  The data gets copied just fine.  

My question is, is there a way in A97 to get the error number that SQL
generates so I know to ignore this error.  If I trap for the Access error it
is just the standard ODBC call failed error which could be anything - Or -
could I rewrite my SQL statement so it doesn't try to copy duplicate records

following is my current sql statement:
INSERT INTO tblDepositsFromVendor (DepositID, DepositDate, AccountNumber,
DepositAmount)
SELECT     deposit_id, deposit_date, account_number, deposit_amount
FROM         vendorserver.venderdatabase.dbo.cw_deposits

thanks


Rusty Hammond



More information about the AccessD mailing list