I agree with mmcdonal (as always, he knows his stuff!)
Its always good practise to keep this kind of logic away from the data, the data store is exactly that, a store. The logic should always be done in your code, this makes maintenence a LOT easier! (change a DB after months/years of use is a NIGHTMARE!)
When loading the data from the store, perform the checks you require, if they fail alert the user that this cannot be done for whatever reason, ditch the data, dont do any updates and close the form if necessary.
If this ever requires changing, you just need to change this logic in the form.
Other than that, you could put a flag on each record saying that it is loaned out, and clear this when the item is checked back in, then you could just "SELECT ... WHERE [Item].[Loaned Out] = False" or something.. I would probably do something like that as it makes readability much better, as well as other things like reporting etc..
Hope this offers some inspiration.
Best Regards,
Rob
|