Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

In saving data from a Form, I want to check for duplicate email and password. If email and password is already in table, prompt with some message. I also tried with many control event but the events were not fired; nothing happened. Maybe my code is wrong, so please help and guide me how to check for duplicate email and password.

Thanks.

share|improve this question

1 Answer

It is generally considered good practice to define validations and constraints at the table level whenever possible. In doing so you ensure that the restrictions are enforced no matter how the data is added or updated (e.g., via an import, an Append Query, etc.) and you don't have to remember to add the validation rule(s) to every form you build.

In your case you would "check for duplicate email and password" by defining a unique index on the table. With the table open in Design View you would click the "Indexes" button on the "Design" tab of the ribbon...

ribbon

...and then define a unique index on the [password] and [email] fields:

indexes

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.