devxlogo

Inserting a Duplicate Record

Inserting a Duplicate Record

Question:
When creating a database (using the Access 1.1 engine) and selecting a field to be a primary index and requiring a unique index value, what will happen when the program is running and the user tries to enter a duplicate record? Will the program crash, or will a message pop up telling the user that he is trying to enter a duplicate record?

Answer:
You will need to use an error trap with On Error Goto error_handler label to make this work. You can trap the error when it occurs. Try doing what you described and you can look at the Err property for the number, and Error$ for the text.

See also  How to Create and Deploy QR Codes Online: A Comprehensive Guide
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist