Hey, I'm a noob on the forum so please bare with me.
For my ICT project, I have to create a new system for a company. I am doing a Video Rental Database. My user wants to be able to work out the Percentage Recovery on a film, so that he knows how much he has made. The equation for this would be:
(sum of costs to rent the film and fines)/cost to purchase film from supplier x 100
The cost to rent a film a night is usually £2.50, so the equation would work out how much we have made from renting the film out (as in all the £2.50s we got), plus any fines charged. Divide this by how much it cost the boss to buy the film from the supplier (usually around £31 or so), multiplied by 100 to give it as a percentage.
Rental costs (as in the £2.50s) and fines are in tblRental under "Cost" and "Fines". The cost to purchase the film is under "Cost" in tblVideo.
I want it so that when I type in the Video ID (primary key of tblVideo, shared primary key (foreign key to tblVideo) in tblRental) using a parameter criteria (eg. [Please type in Video ID]) that the Video ID and Title (from tblVideo) appear next to this calculated field.
My first attempt used the following expression:
Percentage Recovery: (tblRental!Cost+tblRental!Fines)/tblVideo!Cost*100
This worked fine, but only when the film had been rented out once, meaning there was only one entry of this film in tblRental. When it had been rented out multiple times, I got a table showing up with the film being displayed as many times as it had been rented, but with no sort of percentage recovery next to it. Obviously this is useless.
I then decided that I would need to tell Access to sum up all of the rental costs and all of the fines under the specific criteria the user types. So my next attempt used the following expression:
Percentage Recovery: (Sum(tblRental!Cost)+Sum(tblRental!Fines))/tblVideo!Cost*100
When trying to run this query, it tells the query does not include the specified expression "Video ID" as part of an aggregate function. Why though? I want it to add the costs where the criteria is the Video ID the user types, so Video ID shouldn't have to be built into the expression should it?
I don't know where I'm going wrong, but I need help and fast!
For my ICT project, I have to create a new system for a company. I am doing a Video Rental Database. My user wants to be able to work out the Percentage Recovery on a film, so that he knows how much he has made. The equation for this would be:
(sum of costs to rent the film and fines)/cost to purchase film from supplier x 100
The cost to rent a film a night is usually £2.50, so the equation would work out how much we have made from renting the film out (as in all the £2.50s we got), plus any fines charged. Divide this by how much it cost the boss to buy the film from the supplier (usually around £31 or so), multiplied by 100 to give it as a percentage.
Rental costs (as in the £2.50s) and fines are in tblRental under "Cost" and "Fines". The cost to purchase the film is under "Cost" in tblVideo.
I want it so that when I type in the Video ID (primary key of tblVideo, shared primary key (foreign key to tblVideo) in tblRental) using a parameter criteria (eg. [Please type in Video ID]) that the Video ID and Title (from tblVideo) appear next to this calculated field.
My first attempt used the following expression:
Percentage Recovery: (tblRental!Cost+tblRental!Fines)/tblVideo!Cost*100
This worked fine, but only when the film had been rented out once, meaning there was only one entry of this film in tblRental. When it had been rented out multiple times, I got a table showing up with the film being displayed as many times as it had been rented, but with no sort of percentage recovery next to it. Obviously this is useless.
I then decided that I would need to tell Access to sum up all of the rental costs and all of the fines under the specific criteria the user types. So my next attempt used the following expression:
Percentage Recovery: (Sum(tblRental!Cost)+Sum(tblRental!Fines))/tblVideo!Cost*100
When trying to run this query, it tells the query does not include the specified expression "Video ID" as part of an aggregate function. Why though? I want it to add the costs where the criteria is the Video ID the user types, so Video ID shouldn't have to be built into the expression should it?
I don't know where I'm going wrong, but I need help and fast!