I use MS Access database. I have a primary key declared and MS Access throwing an error message box when I try to type in a record manually with primary key violation.
But the VB6 code catches no error when it attempts duplicate primary key entry. The transaction is however not successful. My code is as follows.
.....
On Error GoTo err_add
.....
sql_string = "INSERT INTO ......"
Form1.db.Execute (sql_string)
....
err_add: MsgBox "Duplication is prohibited.", vbCritical, "Error"
The Err.number value is zero and the message box never appears.
Please help.
But the VB6 code catches no error when it attempts duplicate primary key entry. The transaction is however not successful. My code is as follows.
.....
On Error GoTo err_add
.....
sql_string = "INSERT INTO ......"
Form1.db.Execute (sql_string)
....
err_add: MsgBox "Duplication is prohibited.", vbCritical, "Error"
The Err.number value is zero and the message box never appears.
Please help.