Results 1 to 12 of 12
  1. #1
    Durga is offline Novice
    Windows 10 Access 2003
    Join Date
    Nov 2016
    Posts
    20

    Access 2003 total price calculation

    Hi Folks,



    I am trying to design a form which enables a person to select a few products from a table (Used combo box, is this the best option?) which lists 'product' and 'price', and calculate the total in the total price field:

    Click image for larger version. 

Name:	total.gif 
Views:	20 
Size:	18.3 KB 
ID:	37811

    How do I go about doing this? In the combo box once I select a product, it is only displaying the product or the price but not both, even so how can I show the total for the selected products in the total price field? Is there any easier way to do this? Any help will be much appreciated. Thank you.




  2. #2
    phivosz is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2014
    Posts
    17
    I would let the combobox display the product description and add a text box for each product next to the combo box to display the price once the product is selected in the combo box (use the afterupdate event of the combobox to store the price in the text box). Suppose the text boxes are named Text1, Text2 etc. Then in the total price text box type "=Text1 + Text2 + Text3 + Text4 + Text5"
    Last edited by phivosz; 03-13-2019 at 08:44 AM. Reason: Pr

  3. #3
    Durga is offline Novice
    Windows 10 Access 2003
    Join Date
    Nov 2016
    Posts
    20
    Quote Originally Posted by phivosz View Post
    I would let the combobox display the product description and add a text box for each product next to the combo box to display the price once the product is selected in the combo box (use the afterupdate event of the combobox to store the price in the text box). Suppose the text boxes are named Text1, Text2 etc. Then in the total price text box type "=Text1 + Text2 + Text3 + Text4 + Text5"
    Thank you for your reply phivosz, will try this and get back to you.

  4. #4
    phivosz is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2014
    Posts
    17
    My pleasure. Another idea is to use a multi select list box and select the 5 products in one go. Let me know if you need any help.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Your data is not normalized:

    http://www.fmsinc.com/MicrosoftAcces...transpose.html

    products sold should be in a table where each product sold is a separate record. Then your solution is a simple Sum.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Durga is offline Novice
    Windows 10 Access 2003
    Join Date
    Nov 2016
    Posts
    20
    Quote Originally Posted by phivosz View Post
    My pleasure. Another idea is to use a multi select list box and select the 5 products in one go. Let me know if you need any help.
    Will try both options but unfortunately I do not have exclusive access to the file now hence I will have to wait....

  7. #7
    Durga is offline Novice
    Windows 10 Access 2003
    Join Date
    Nov 2016
    Posts
    20
    Quote Originally Posted by pbaldy View Post
    Your data is not normalized:

    http://www.fmsinc.com/MicrosoftAcces...transpose.html

    products sold should be in a table where each product sold is a separate record. Then your solution is a simple Sum.

    Hi pbaldy, thank you. The products are contained in a separate table as individual records.

  8. #8
    Durga is offline Novice
    Windows 10 Access 2003
    Join Date
    Nov 2016
    Posts
    20
    Quote Originally Posted by phivosz View Post
    I would let the combobox display the product description and add a text box for each product next to the combo box to display the price once the product is selected in the combo box (use the afterupdate event of the combobox to store the price in the text box). Suppose the text boxes are named Text1, Text2 etc. Then in the total price text box type "=Text1 + Text2 + Text3 + Text4 + Text5"
    I have got the 5 combo boxes and the five corresponding text boxes to display the prices. However the total price field is not returning a total value but just #Name?

  9. #9
    phivosz is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2014
    Posts
    17
    Quote Originally Posted by Durga View Post
    I have got the 5 combo boxes and the five corresponding text boxes to display the prices. However the total price field is not returning a total value but just #Name?
    Dear Durga, That means there is something wrong with the source of the total price field.
    Anyway look at the example I am sending youDatabase5.accdb

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Quote Originally Posted by Durga View Post
    Hi pbaldy, thank you. The products are contained in a separate table as individual records.
    They should be in this table as well, almost certainly. What if there are 6 products sold?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    Durga is offline Novice
    Windows 10 Access 2003
    Join Date
    Nov 2016
    Posts
    20
    Quote Originally Posted by pbaldy View Post
    They should be in this table as well, almost certainly. What if there are 6 products sold?
    The product field is just an example I have used whereas in my database the maximum number of 'product' any one would use at any one time is 5.

  12. #12
    Durga is offline Novice
    Windows 10 Access 2003
    Join Date
    Nov 2016
    Posts
    20
    Quote Originally Posted by phivosz View Post
    Dear Durga, That means there is something wrong with the source of the total price field.
    Anyway look at the example I am sending youDatabase5.accdb
    Will check it out thanks, thought I had done the difficult bit and that the totals field will be a lot easier, as inserting '=[textvalue1]' in the control source of the total field returns the value in the first text box but it is when using the '+' for other text boxes that triggers the error.

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

Similar Threads

  1. Total Price after Sum in Query
    By Mashknight in forum Queries
    Replies: 16
    Last Post: 01-29-2019, 01:49 PM
  2. Price Calculation base upon product age
    By streub in forum Access
    Replies: 6
    Last Post: 11-13-2017, 09:31 AM
  3. Replies: 2
    Last Post: 10-06-2015, 04:32 PM
  4. Replies: 2
    Last Post: 03-02-2011, 01:43 PM
  5. Calculation in a form Access 2003
    By 1943 in forum Forms
    Replies: 2
    Last Post: 02-16-2011, 12:28 PM

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