Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    daniel.ru92 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    20

    Question Need help with delivey form...

    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

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    Could you please post a jpg of your tables and relationships? I'm sure readers would be interested in your database structure.

    There is a free data model for a restaurant delivery service at
    http://www.databaseanswers.org/data_...vice/index.htm

    Good luck with your project

  3. #3
    daniel.ru92 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    20
    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.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    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.

    http://www.rogersaccesslibrary.com/T...lationship.zip

  5. #5
    daniel.ru92 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    20
    Click image for larger version. 

Name:	help.jpg 
Views:	3 
Size:	187.0 KB 
ID:	11434
    here is my form!

  6. #6
    daniel.ru92 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    20
    Click image for larger version. 

Name:	help2.jpg 
Views:	5 
Size:	76.2 KB 
ID:	11435
    thats my tables and connections

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    You are right, it isn't English and I don't understand the details.

    Customers make Orders that are Delivered. So I think your relationship between Customer and Delivery is incorrect.

    Here's a generic model of Customers and Orders with a Delivery

    http://www.databaseanswers.org/data_...ders/index.htm

  8. #8
    daniel.ru92 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    20
    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.

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    So you are saying you can deal with Orders and Deliveries only.
    OK

    So 1 Del1very can be made of 1 or more Orders

    So the relationship is
    1---------->Many
    Delivery -->Orders

    This is classic Form --SubForm
    but it also means you can not have an Order until you have a Delivery.

    See if this free video tutorial helps.
    https://www.youtube.com/watch?v=YZKN_-P6wck

  10. #10
    daniel.ru92 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    20
    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?

  11. #11
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    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.
    Attached Files Attached Files

  12. #12
    daniel.ru92 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    20
    Thank you very much my friend! I understood you did the sum function via VB. I'll try to learn your code and copy the idea.

  13. #13
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    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.

    Good luck.

  14. #14
    daniel.ru92 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    20
    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!

  15. #15
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    No problem. Get some sleep.

    I did some more testing. The date format of General Date works, I just didn't enter the time component.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums