|
-
Aug 11th, 2000, 02:29 AM
#1
Thread Starter
Lively Member
I have a datagrid with some records...if I add a record with a duplicate primary key I get an ODBC error informing that I have attempted to adda record with duplicate key...I'm happy with this BUT...the there are no error numbers or any visible way I can set up an error trap for this situation..is there a way that I can trap this error!
I'm using an Access 97 database with ADO as my method of access.
Ta
Gerard
-
Aug 11th, 2000, 06:39 AM
#2
Well ....
The simplest way to avoid that error is to generate the primary key through your application so that it is unique.
You can use the On Error statement, or use the RDO Errors collection object to trap the errors. For more help refer to the MSDN help and still if it doesn't help, we are here to help you out.
-
Aug 11th, 2000, 11:43 AM
#3
Frenzied Member
Originally posted by gerard
I have a datagrid with some records...if I add a record with a duplicate primary key I get an ODBC error informing that I have attempted to adda record with duplicate key...I'm happy with this BUT...the there are no error numbers or any visible way I can set up an error trap for this situation..is there a way that I can trap this error!
I'm using an Access 97 database with ADO as my method of access.
Ta
Gerard
Check the value of Err.number in debug, after you attempt to add a duplicate key. Then add code to check for that value.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|