- Local time
- Yesterday, 21:18
- Joined
- Feb 28, 2001
- Messages
- 30,983
In case Pat doesn't catch this one right away...
This is a quite good question because it emphasizes that there are various ways to approach a problem in Access.
Here is the (perhaps undesirable) side-effect of having non-unique data entry attempted to a field that should be unique - error trapping. The result of the attempt to enter a duplicate value to a table would be a Constraint Error/Violation, which is a run-time error. If you didn't build a good error handling routine, you would crash the form. In such a case, you could have a complex error cleanup. And you don't DARE allow the error to not be handled because unhandled errors lead you to the Access "Last Chance" handler that gives you the dreaded "DEBUG/RESET" dialog box. And a RESET stops everything cold (and broken).
IF you are comfortable with error handling, then indexing the field with a uniqueness constraint is a quite decent way to handle the problem. If you are not comfortable with error handling, you will think "Why, oh WHY didn't I realize that the can I just opened was labeled 'Worms'?" You just have to understand "the cost of doing business."
It is all a matter of what makes you comfortable. What do you THINK you can do? Answer THAT question and you will know how to handle the initial question happily.
This is a quite good question because it emphasizes that there are various ways to approach a problem in Access.
Here is the (perhaps undesirable) side-effect of having non-unique data entry attempted to a field that should be unique - error trapping. The result of the attempt to enter a duplicate value to a table would be a Constraint Error/Violation, which is a run-time error. If you didn't build a good error handling routine, you would crash the form. In such a case, you could have a complex error cleanup. And you don't DARE allow the error to not be handled because unhandled errors lead you to the Access "Last Chance" handler that gives you the dreaded "DEBUG/RESET" dialog box. And a RESET stops everything cold (and broken).
IF you are comfortable with error handling, then indexing the field with a uniqueness constraint is a quite decent way to handle the problem. If you are not comfortable with error handling, you will think "Why, oh WHY didn't I realize that the can I just opened was labeled 'Worms'?" You just have to understand "the cost of doing business."
It is all a matter of what makes you comfortable. What do you THINK you can do? Answer THAT question and you will know how to handle the initial question happily.