Originally posted by rathi
Hi everyone,

I want to make sure that the user does not enter duplicate primary key and as well as it is not empty.

How can I trap these errors?

Any help is greatly appreciated.

sincerely,

Rathi.J
In ACCESS set your primary key. In Access Set Ignore Nulls = No.

In VB in the event that triggers the addnew method check for null field. Then Place an On Error Goto Statement before the insert code, in the Error Handler Use MsgBox to tell the user that the data entered is invalid. Exit the Sub or Function without adding a record.

Hunter