RainLover
VIP From a land downunder
- Local time
- Tomorrow, 04:09
- Joined
- Jan 5, 2009
- Messages
- 5,039
Great example! Your code doesn't do a search. The search is what you are saying the user has already done in a combo box. That's fine if your data set is small enough to eyeball in a combo box but no good at all if you need to search for one record among thousands or millions. To do that you would first execute a query based on the natural key (or whatever other attributes the user wants to search on). Note that your bookmark lookup based on the surrogate key is actually an additional operation - it's an extra overhead while doing absolutely nothing to improve the performance of the actual search.
Determining / designing natural keys certainly requires work but it's extremely important to do it. Failing to identify a natural key can ultimately be a lot more work because one day someone will probably have to clean up the data quality issues that result from misidentification/duplication of data. Some of us have had to deal with such clean-up operations a few times - especially in cases where the original designer just put in a surrogate key and clearly didn't bother to think about what natural keys were needed.
What do you mean by saying that the code does not do a search. And this bit about, it has to be for thousands of records is not really a search.
I can make it bigger if it was needed. I use much bigger on a daily basis. Or should I say my Database does. My object was to hide the Primary Key which you said was not possible. But as you can see with that one eye that is still open that I have completed the challenge without fail.
The code itself proves that you do not need to see the Primary. I have done that but you appear not to be able to see the wood from the trees.
I know what you are going to say. "This is only finding a Record not Searching for a Record"