Results 1 to 7 of 7
  1. #1
    Lewis825 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2015
    Location
    UK
    Posts
    19

    Store Calculation In Table And Run As Code In Form

    Hi Guys,

    Ok I have a table which lists suppliers, each of our suppliers have diffrent discount stuctures.
    These discount structures are stored in the supplier table as a simple math equation

    The Aim Is...

    When adding a new product I want to automaticlly work out my cost price at the click of a button dependant on the Supplier ID entered on the form.

    so the code will look at the supplier, get the formula from the suppliers record, run that formula with the Lsit Price entered on the form, then throw out my cost price after discounts & conversions.

    Hope this makes sense.....



    Thanks In Advance

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Can you give an example of what the stored math equation looks like? Presumably it is text.

    You can probably achieve what you want using the Eval() function.

    For example, if X=3, and your "equation" y= "*2" as a string, then eval(x & y) yields 6 (2*3)

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    Further to John's question and advice, do you have the same discount for all products for a given supplier? Is/are there different discount structures for different quantities?

    Discount rate for 1-20 of product X; discount rate for 500-999 of product X????

    Sample data to illustrate your intent would help.

  4. #4
    Lewis825 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2015
    Location
    UK
    Posts
    19
    Thank you for your input,

    the discount sturcres are

    sup1 - ((ListPrice-60%)-5%)/ConversionRate
    sup2 - (ListPrice-50%)/ConversionRate
    sup3 - ListPrice-30%
    sup4 - ListPrice (No Discount Given)

    We do not get price breaks depandant on quantity so no need to worry about that

    Hope this Helps,

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    It appears that you have a limited number of Suppliers.
    What happens if/when you get 2, 5, 10 new suppliers?

    What exactly is Conversion Rate?
    You are saying that every Product regardless of quantity has the same discount rate, correct?

  6. #6
    Lewis825 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2015
    Location
    UK
    Posts
    19
    Quote Originally Posted by orange View Post
    It appears that you have a limited number of Suppliers.
    What happens if/when you get 2, 5, 10 new suppliers?

    What exactly is Conversion Rate?
    You are saying that every Product regardless of quantity has the same discount rate, correct?
    This is just a smaple of suppliers, we currently have around 30 suppliers, and add new ones on a weekly basis.

    hence the reason i would like the admin staff to be able to add a new supplier and work out our cost prices on the click of a button, with out having to calculate it them selves or add a formula into the VBA coding

    conversion rate is to do with the currency, we have to convert some prices from Euro to GBP

    Yes, prices are the same regardless of quantity

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    It seems you have a relatively complex calculation. I say that because ListPrice is not a constant. Suppliers and vendors often change/adjust prices. And for some stock/items, there may be block discounts/clearance to move stock before fiscal period end etc.

    I have written a few posts referencing AgreedToPrice ,historic orders , discount which may be useful.

    You might consider DiscountRate or similar field with values such as .23 (23 % discount). This would be applied to the current ListPrice... I also think you should be clear on your Price fields/definitions. Current selling price, list price, cost price, discounted Price, AgreedToPrice...
    Especially if, as you say, users are recording new discount factors etc. I don't agree that general users should be modifying/inserting the discounting algorithm anywhere. The value of a user interface, forms and logic is that you control the various components that are involved. A simple coding/typo can not get saved. There is always some "does the values make sense" test to ensure there are no 200 % discounts etc.

    There was a poster who had different rates for each product for each customer and then had factors based on volume purchases. It was tedious to monitor and maintain.

    Might be easier to have a limited number of categories, each with an identified discount factor. Then assign a supplier to a category, and the discount factor is mostly automatic. This sort of thing will reduce maintenance and does not preclude loyalty programs nor individual agreed to prices.

    Good luck. Hope some of this is helpful.

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

Similar Threads

  1. Replies: 5
    Last Post: 11-21-2015, 08:48 AM
  2. Code to store a value in table where ID = X
    By iProRyan in forum Access
    Replies: 9
    Last Post: 03-21-2014, 11:17 PM
  3. Replies: 5
    Last Post: 01-27-2014, 04:45 PM
  4. Replies: 5
    Last Post: 11-17-2013, 04:20 PM
  5. Replies: 2
    Last Post: 12-02-2012, 09:14 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