I have a fear to good understanding of Using Visual Basic 6.0 Codes.

Im using code to create ADO Cmdobjects & RecordSets to connect and handle records in an Access 2003 mdb. In the Accounts table, I have indexed the field Name property to Yes (No Duplicates).
I using the following code inside the BtnSave botton to trap duplication error:

Private Sub CmdGuardar_Click()
' guardar modificaciones y nuevos registros cuentas
On error goto Trap
Call Valide_Encabezados
If Valida = False Then Exit Sub
If LblMODE.Caption = "Añadir Indicadores" Then Ctas.AddNew
Ctas("CtaName")=txtName.text
Ctas.Update
DgCtas.Rebind
Exit sub

Trap:
MsgBox "Duplicate entry", vbCritical, "Error Information"
txtCtas.SetFocus

End Sub

I'm traping the error, but need extra code the prevent a couple of issues:
1- The Datagrid is still been populated with the new entry.
2- I have tried CtasCancel, CtasCancelUpdate but nothing seens to help clering the error
completely, messages like "Update was canceled", "To prevent duplicate entries
change field name property etc
3- Upon closing the form using unload botton and including code to close the table as well
as follows: Ctas.Close, I getting another error message "Operation is not allowed in this
context".

I'm using a MDI form from wich I connect to the Access Database, and only open tables as needed in the forms.

Do not know what I'm doing wrong, any one out there with any sudgestions, thank you
in advance for any help provided.