Results 1 to 4 of 4
  1. #1
    Luke.F.14 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    3

    Calculating the sum of a combo box?


    Hi

    I'm creating a database for my a level IT course about car hire. On my Order form i have a sub form containing details about each car that the customer has hired aswell as the date in and out and a combo box containing the total price (calculated by multiplying the price per day of that car by the number of days it's hired for). I would like to be able to create a combo box on the main order form that calculates the overal order total price - which would be the sum of the total price boxes on each car in the sub form. Since it's only one field that's repeated for each car that's hired by that customer i can't do the sum of them all - it's only one field. Does anyone have any ideas?

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    A combobox is an object that provides the users with multiple entries whereby they make a selection. This should be a textbox, not enabled.

    On the footer of your subform add a textbox with a control source of : =Sum(price/day * numdays). This will give you the order total. You can additionally add a textbox to the main form altho there is no need.

  3. #3
    Luke.F.14 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    3
    Yes i meant text box not combo box, sorry. I just tried this however i just get #error appear in the text box. This is what i entered as the control source:

    =Sum(([Date In]-[Date Out] +1)*([Car Copy ID].[Column](8)))

    ([Date In]-[Date Out] +1) is the number of days and ([Car Copy ID].[Column](8)) is the price per day.

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Make them fields on the subform which you can then sum. Do the calculations in the record source for the subform so that they have actual field names.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Calculating Ages
    By kymwilkinson in forum Queries
    Replies: 3
    Last Post: 05-26-2015, 01:32 PM
  2. Calculating sum of selected option/combo boxes
    By SgtSaunders69 in forum Forms
    Replies: 4
    Last Post: 08-04-2014, 09:20 PM
  3. calculating
    By cade1980 in forum Access
    Replies: 3
    Last Post: 04-17-2012, 10:42 PM
  4. Calculating Age
    By Koyangie in forum Queries
    Replies: 2
    Last Post: 04-05-2012, 03:11 PM
  5. Calculating Age from DOB
    By coolpal9 in forum Forms
    Replies: 15
    Last Post: 01-12-2012, 05:26 AM

Tags for this Thread

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