I want to add a record to an Access table which I've configured as an ODBC datasource. Even if I run a query to see if the proposed key already exists, I still have to check for a "duplicate key" error after the INSERT. The problem is that CFCATCH is returning a CFCATCH.NativeErrorCode value of -1605 (yes, with a minus sign). My Access manual says the "duplicate key" error code is 3022, and this is what I get if I try to add a duplicate key in VB.
Even crazier, if my error-handler tests for -1605 it does not get a match and so does not recognise the cause of the error.
So what's going wrong and how can I fix / avoid / work round it?
Notes on software I'm using:
CF version 4.01
Windows 98 with Personal Web Server
I've tried setting the DB up as an Access 2.0 DB (the last Win 3.1 format) and as an Access 3.0 DB (Access 95 or 97 format, I'm not sure which). In either case I have the same problem with INSERT but the rest of my DB accesses work fine.
Here's an outline of the code:
<cftry>
[the INSERT code - works fine if not duplicate key]
<cfcatch type="Database">
<cfswitch expression="CFCatch.NativeErrorCode">
<cfcase value="-1605">
[create "duplicate key message to display]
<cfcase>
<cfcase value="....">
[handle other errors]
</cfswitch>
</cfcatch>
</cftry>
Even crazier, if my error-handler tests for -1605 it does not get a match and so does not recognise the cause of the error.
So what's going wrong and how can I fix / avoid / work round it?
Notes on software I'm using:
CF version 4.01
Windows 98 with Personal Web Server
I've tried setting the DB up as an Access 2.0 DB (the last Win 3.1 format) and as an Access 3.0 DB (Access 95 or 97 format, I'm not sure which). In either case I have the same problem with INSERT but the rest of my DB accesses work fine.
Here's an outline of the code:
<cftry>
[the INSERT code - works fine if not duplicate key]
<cfcatch type="Database">
<cfswitch expression="CFCatch.NativeErrorCode">
<cfcase value="-1605">
[create "duplicate key message to display]
<cfcase>
<cfcase value="....">
[handle other errors]
</cfswitch>
</cfcatch>
</cftry>