Default Error Boxes

  • Thread starter Thread starter Mark Stones
  • Start date Start date
M

Mark Stones

Guest
Hello, I would appreciate it if someone could help me with a problem i have.

I have a subform which i use to enter new data. This form has a indexed primary key (serial Number) and a message box pops up everytime I enter a duplicate value. I have tried using the following code for error handling to correct this but it does not work;

Err_done_click:
Select Case Err
Case 684
MsgBox "Duplicate", vbOKOnly, "Duplicate"
Case Else
MsgBox Err.Number
Resume Exit_done_Click:
End Select

Any Ideas?

Thank you

Mark
 
Hi Mark

Perhaps I have misunderstood your problem, but from what you have written it seems you are trying to duplicate the primary key for records. No error trapping will over-ride this feature of a relational database - that you cannot have two records with the same Primary Key (this defeats the object of the Primary Key which is there to uniquely identify each record).

If you are trying to link another table via a Primary key in your main table then perhaps your relationship is not set up properly or you may have set the index on that Foreign Key within the child table to "Yes, but NO Duplicates allowed". This needs to be set to "Yes, duplicates allowed" in the child table.

HTH

Rich

[This message has been edited by Rich@ITTC (edited 02-05-2001).]
 

Users who are viewing this thread

Back
Top Bottom