Results 1 to 4 of 4
  1. #1
    SRessler is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    2

    Calculate Multiple Fields for Extended Price

    I have a query in my database that sums the Count*Unit Price-Discount with the following formula.

    Extended Price: CCur(Nz([Count],0)*[UnitPrice]*(1-[Discount]))

    I would like to add another field called "Weight" into that formula. Basically I want to sum the total by either:

    Count*Unit Price-Discount = Extended Price
    or
    Weight*Unit Price-Discount = Extended Price

    We price items out by count and/or weight and customers may have both types of items in one of their Orders



    My query line would be like this;
    Product Count Weight Unit Price Discount Extended Price

  2. #2
    LillMcGill is offline Dagny fan
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Oct 2010
    Location
    Southern USA
    Posts
    70
    Does this work?
    IIF([Count] Is Null, [Weight]*[UnitPrice]*(1-[Discount]),[Count]*[UnitPrice]*(1-[Discount]))
    I would consider renaming [Count] to a word that isn't a reserved word and the name of a built-in function.

  3. #3
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    hmmm well I believe the correct syntax suggested should be: IIF(IsNull([Count]), etc etc

    but as you state there may be both - then I guess you calc both and if one isn't there just put in a 0 or leave it null.

  4. #4
    SRessler is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    2
    LillMcGill

    Thank you so much. It worked perfectly. You are a life saver.

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

Similar Threads

  1. Replies: 4
    Last Post: 09-22-2010, 01:47 AM
  2. Replies: 0
    Last Post: 05-02-2010, 10:21 PM
  3. Replies: 1
    Last Post: 12-10-2009, 08:41 PM
  4. Multiple Price Columns
    By kmwhitt in forum Access
    Replies: 0
    Last Post: 04-04-2009, 09:48 PM
  5. Replies: 0
    Last Post: 02-26-2009, 04:30 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