I built a database for a restaurant delivery service. One table "menu" I put all the products and prices. Table "Orders", refers to any dish from the menu invites the user, plus comments. Also, any order given there's a delivery number. Table "delivery" rules of the shipment details (client, address). How do I calculate the total price of the dishes to the table "delivey" for every delivery?
In addition, I would like to add a control to a form which entered shipping charges (5% of invitation with the option to change). Calculating the total price will include the shipping charges.
Thank you
First of all, thank you for the fast answer. I can't find the download link in that site. Also, my project isn't in English so I guess you won't understand it. I build it very simple, so in my delivery form, the user type the client id, the time it accepted and more info. In that form I crated a sub form to the orders form. In that form the user type the dish id, and the name of the dish and the price shows (the orders table linked to the menu table). When I want the form to calculate the sum of the order, in the main form, I can't find the way to calculate the sum, the only thing I succeeded to do is to link to another area in the sub form ([orders].[price]). I can't find the function that calculate all the prices of the orders that linked to that specified delivery.
Before Forms and controls, it is better to get your tables identified, normalized and the relationships between them established and tested. The database (tables and relationships) structure is like the foundation of a house. If the foundation is bad, it doesn't matter what colour the paint is. So the bottom line is get your foundation in great shape and things will go easier.
There is a tutorial at the site below that leads you through all steps from business facts to database.
The customers don't belong to the problem. The problem is how to calculate all the orders that belong to the delivery (the order in the sub form and the delivery is the main form).
The sum should be in the main form.
Thank you again. So lets talk for that YouTube example. If I wanna run function on the main form (students table) that will calculate sum or avg or whatever on all the courses that the student take, and show the result on the main form, how do I run it?
Here is a sample database. I'm just guessing at some of the logic and fields, but it may give you some ideas.
I'm doing this in AC2010 and am not familiar with the interface.
Hope it's helpful.
You are welcome. A couple of points. I removed a field in the table for TotalPrice on tblDelivery. I didn't take it out of the table, I just renamed it.
You shouldn't store totals in a table (usually). I have made a field on the form to show the Total for the delivery. It does a rollup of the Orders and adds the delivery charge whether the standard 5% or a custom delivery charge.
As I said the interface is new to me and I find it very confusing.
Also, I could not get the form to display General Date (dates with Time) even though they are defined so at the table level.
I'm looking at it now (google), but haven't found an answer.
Anyway, it gives you something to work with. Change it as you need to.
I tried all the ways how to calculate that sum of orders, and thought there is simple way to do it. I know vba very good, but never tried it on access, only on excel.
So I'll start to learn your vba project, but I'll do it tomorrow, because it's already night in Israel... Good night and thank you again!