Results 1 to 4 of 4
  1. #1
    Lesg is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    101

    discounting of prices line items combo select

    Hi Guys, I have a combo box on an invoice line item subform and use:

    Code:
     strFilter = "ProductID=" & Me!cboProducts
     Me!price = DLookup("price", "products", strFilter)
    To pull the price into the line item, however, each customer can have a different discount level, 5%, 6.25% etc so I need a way to apply the discount to the price.

    The parent form has the discount amount available: Forms![frmOrderPlacement]![txtDiscount] so wondered if there was a way to calculate the final price within the combo selection process like:

    Code:
    Me!price = DLookup("price*Forms![frmOrderPlacement]![txtDiscount] ", "products", strFilter)
    but assume as its a Dlookup it simply wants to get the value of price and cannot do a calculation at this point?



    So any suggestions would be appreciate.

    I don't want to create a temp table, as the users are using a multiuser virtual desktop, so temp table don't work.

    Thanks in advance.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Create a calculated filed in the Query used for the combo box. You should be able to reference the discount on the main form from the query.
    If you still have difficulties, post a copy of the db with just a few bogus records for us to play with.
    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
    Lesg is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    101
    Hi Bob, thanks for that feedback, I have just had a moment of clarity and had added:

    Code:
    Me.rate = Forms!frmOrderPlacement!txtDiscount
    Me.price = price - (price * rate / 100)
    which has resolved the problem

    I spent hours yesterday then 5 minutes after posting this question, it came obvious to me!

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Quote Originally Posted by Lesg View Post
    Hi Bob, thanks for that feedback, I have just had a moment of clarity and had added:

    Code:
    Me.rate = Forms!frmOrderPlacement!txtDiscount
    Me.price = price - (price * rate / 100)
    which has resolved the problem

    I spent hours yesterday then 5 minutes after posting this question, it came obvious to me!
    Glad you have a solution to your problem.
    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: 8
    Last Post: 03-17-2022, 09:16 AM
  2. Replies: 24
    Last Post: 09-14-2021, 02:37 PM
  3. Replies: 4
    Last Post: 12-25-2016, 10:46 AM
  4. Add all line items to inventory
    By saudkazia in forum Programming
    Replies: 8
    Last Post: 10-12-2015, 09:38 AM
  5. Multiple detail items per line
    By needafix in forum Reports
    Replies: 3
    Last Post: 10-22-2009, 11:04 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