Visual Basic Database Tutorial - Part 6
Binding, binding, binding. Sounds a bit boring doesn't it?
I'd much prefer the word "bonding". Even better, "bondage". But unfortunately that just wouldn't go. Sure, we all know this is a family website, but the Editor's on holiday in France this week so why not? ...
Do you remember all the bondage we encountered back in the distant realms of tutorial one? How we tied that text box direct to the database! We just added a data control, threw a few text boxes on a form, set a couple o' properties... and hey presto, we're up-and-running.
But with the wizzy database design you created last week, that just isn't possible anymore. For instance, if you wanted your users to enter new pets into the Pets table, your database requires a PetName, Breed... and an OwnerID.
If you remember, the OwnerID is a Foreign Key. In other words, it's a number that links this particular record to a parent record in the Owners table.
But asking your end user to input an OwnerID isn't very user friendly. And when you start creating databases that are absolutely jam-packed full of Foreign Keys, it'll become more confusing then the Arabic translation of Stephen Hawking's "Bumper Book of the Galaxy".
So you need to make it simple, by allowing them to select an owner from a list... but you should still insert the OwnerID number into the field.
How do you do this? By use of a few little-known control properties...
Page 2 of 6