Results 1 to 13 of 13
  1. #1
    Abdulaym is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Jul 2023
    Posts
    33

    Updating product price

    Hi, trust you are all doing great?
    I noticed that when I update my product price to a new price the old price which I have already issued invoices for also change to the new price. e.g I sold bag for $10 a week ago and now the price increase to $12. I want the one I sold for $10 to remain as $10 and the new sales to be $12.
    Thanks for your usual assistance

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2019
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    You should have a field in the sales detail table to store the price of each sale.
    On the sales detail form you should have a combo based on the products table.
    Use the after update event of the combo to enter the current price into the price on the form.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Abdulaym is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Jul 2023
    Posts
    33
    Sir how do I Use the after update event of the combo to enter the current price into the price on the form. I mean the code sir.
    Attached Thumbnails Attached Thumbnails tmp-cam-8697540709765929260.jpg  
    Last edited by Abdulaym; 07-25-2023 at 08:03 AM. Reason: To attached file

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    It is simple value asignment?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2019
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Can you post a copy of the db
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    In tblSales you need to add a field "CostPrice"
    Then on your Form with the Combobox you use to select the Product.
    The Combobox Record Source will include the Cost Price

    Code:
    SELECT tblProducts.Product_ID, tblProducts.Product_Name, tblProducts.Unit_CostFROM tblProducts
    ORDER BY tblProducts.Product_Name;
    Then in the After Update of the Combobox you would have the following AfterUpdate Event

    Code:
    Me.CostPrice = Me.cboProducts.Column(2)
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  7. #7
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  8. #8
    Abdulaym is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Jul 2023
    Posts
    33
    Thanks for the response sir, am new in Access, pls how do I enter the first code sir? And how do I include the Cost Price in the code? Thanks

  9. #9
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Quote Originally Posted by Abdulaym View Post
    Thanks for the response sir, am new in Access, pls how do I enter the first code sir? And how do I include the Cost Price in the code? Thanks
    And seemingly not prepared to learn?

    Here is code from my diabetes DB.
    This set values for other fields in the record.
    You would just use the Cost field as another value to store.

    Code:
        Me.txtCarbsCalc = Me.cboFoodIDFK.Column(4) * Me.txtFactor
        Me.txtSugarCalc = Me.cboFoodIDFK.Column(5) * Me.txtFactor
        Me.txtFibreCalc = Me.cboFoodIDFK.Column(6) * Me.txtFactor
    Column 4 is carbs, 5 is sugar and 6 is Fibre. The txtControls are bound to fields in the record.

    You will likely need to the same for the tax rate.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  10. #10
    Abdulaym is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Jul 2023
    Posts
    33
    Good day sir, this was the message I got when I enter the first code: Check the subquery's syntax and enclose the query in parentheses.

  11. #11
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Quote Originally Posted by Abdulaym View Post
    Good day sir, this was the message I got when I enter the first code: Check the subquery's syntax and enclose the query in parentheses.
    Seriously?
    What good is that statement to anyone?
    At least show what code you have used and where you have used it.

    Where is a subquery coming into it?, it is a simple value assignment.
    You assign the values in the AfterUpdate of the product control.

    You might be better off buying an off the shelf system?
    This is not a small task you are trying to undertake and if you need it in a short space of time, I can not see that happening.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  12. #12
    Abdulaym is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Jul 2023
    Posts
    33
    @Bob Fitz: sir where will I enter this code sir?is't in the control source of CostPrice or in the Combo that gives me the product?

    SELECT tblProducts.Product_ID, tblProducts.Product_Name, tblProducts.Unit_CostFROM tblProducts
    ORDER BY tblProducts.Product_Name;

  13. #13
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2019
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Quote Originally Posted by Abdulaym View Post
    @Bob Fitz: sir where will I enter this code sir?is't in the control source of CostPrice or in the Combo that gives me the product?

    SELECT tblProducts.Product_ID, tblProducts.Product_Name, tblProducts.Unit_CostFROM tblProducts
    ORDER BY tblProducts.Product_Name;
    In post #5 I asked you
    Can you post a copy of the db
    If you post the db we may be able to make the required changes for you
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Replies: 5
    Last Post: 08-03-2021, 07:33 PM
  2. Price List Structure - Numerous Attributes for Each Product
    By Sunny8760 in forum Database Design
    Replies: 12
    Last Post: 06-21-2018, 12:20 AM
  3. Price Calculation base upon product age
    By streub in forum Access
    Replies: 6
    Last Post: 11-13-2017, 09:31 AM
  4. Last purchase price of a product sale
    By EMAS in forum Queries
    Replies: 4
    Last Post: 12-22-2015, 02:01 PM
  5. Replies: 4
    Last Post: 04-26-2013, 08:32 AM

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