Reputation: 11
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.
Upvotes: 0
Views: 2245
Reputation: 123809
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...
...and then define a unique index on the [password] and [email] fields:
Upvotes: 3