I'm new to VB and was hoping for some kernels of wisdom. Any help is appreciated:
I recently created a program in VB6 that pulls information from an Access database via an ADO connection. The database stores all of our PC assets and uses the unique serial number as its primary key.
The VB program allows someone to browse, create, modify or delete records from the database through text boxes and command buttons.
I want to set up error handling so when someone adds a new record with a serial number that already exists, it brings up a message box telling them that a record already exists with that serial number. As is, the program generates a runtime error and produces this predictable error:
Run-time error '-2147467259 (80004005)'
The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. etc etc.
I figure since an error is generated, I must be able to trap it and give the user some more productive feedback and another chance to redeem themselves.
I recently created a program in VB6 that pulls information from an Access database via an ADO connection. The database stores all of our PC assets and uses the unique serial number as its primary key.
The VB program allows someone to browse, create, modify or delete records from the database through text boxes and command buttons.
I want to set up error handling so when someone adds a new record with a serial number that already exists, it brings up a message box telling them that a record already exists with that serial number. As is, the program generates a runtime error and produces this predictable error:
Run-time error '-2147467259 (80004005)'
The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. etc etc.
I figure since an error is generated, I must be able to trap it and give the user some more productive feedback and another chance to redeem themselves.