ONE TO MANY

  • Thread starter Thread starter HHH
  • Start date Start date
H

HHH

I'm 14 years old. I am making a movie rental database, i
have a problem. I can only lend A Movie at one given time.
Is there a code that will stop 2 movies of the same name
being taken.
 
Hi,


Yes, but I would rather try to keep things nice, without code, such as
adding an additional field, a Boolean, like IsRented, in your initial
table. If you rent a film, check mark this field (or assign True, or Yes) to
it. You want to get the list of available films? rather than using the
initial table, use a query like:

SELECT *
FROM Films
WHERE Not IsRented



and you will use that saved query, instead of the initial table Films, where
you need a list of films available for renting.

When the film is brought back, uncheck the field IsRented, and if you
requery the query, it will be back in the listing.

That may not be the best solution, since you loose track of the history
(how many times the film have been rented, etc. ), but that is an easy way,
without code (or almost), so, with less probability to get bug.


Hoping it may help,
Vanderghast, Access MVP
 
Back
Top