Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2007
    Posts
    102

    Unanswered: obtain results from expressions..

    Hello,

    I've got a question on obtaining results in a couple controls after properly formatting; my earlier attempts gave me #Error or #Name? in the controls. Now I believe I've been able to format expressions correctly, but I'm not getting ANY data in the following controls, not even an error msg.

    My 'Order Subtotal' works.

    the Order Total control:
    Code:
    =[AnOrderSubtotal]+[Order Ship Details Subform].Form!FreightCharge+[Order Ship Details Subform].Form!SalesTaxAlone
    the Sales Tax control:
    Code:
    CLng(Forms![Add an Order and Details]![AnOrderSubtotal]*[ANewSalesTax]*100)
    Info,
    The 'Order Total' relies on a couple fields from the second subform (freight and sales tax).
    Any Ideasl

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Code:
    = Nz([AnOrderSubtotal],0)
    + Nz([Order Ship Details Subform].Form!FreightCharge,0)
    + Nz([Order Ship Details Subform].Form!SalesTaxAlone,0)
    Give this a try.

    Remember in your last thread how we went over what happens when you add NULL to a value?
    George
    Home | Blog

  3. #3
    Join Date
    Aug 2007
    Posts
    102

    I think I fixed it

    Hi GeorgeV,

    I really appreciate your response to my question. While waiting, I continued working and scrambled things about and Wow!, The expressions started working the way I wanted them...

    I moved the 'Order Subtotal and 'Order Total' control to Subform #2

    I do like the use of your Nz because of the Nulls that seemed to pop up in my data from time to time.

    I will post the codes as they are now for my expressions and ask if you can tell me where to place the 'Nz'..I tried a couple ways, but that broke my expressions...Thanks so much:

    the Sales Tax control:
    Code:
    =[AOrderSubTotal]*[ANewSalesTax]
    the Order Total control:
    Code:
    =[AOrderSubTotal]+[FreightCharge]+[SalesTaxAlone]
    thanks again

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    How are AOrderSubTotal and ANewSalesTax calculated?
    Code:
    = Nz([AOrderSubTotal],0)
    + Nz([FreightCharge],0)
    + Nz([SalesTaxAlone],0)
    George
    Home | Blog

  5. #5
    Join Date
    Aug 2007
    Posts
    102
    Hi GeorgeV,

    I tried your suggestions in post #4, it broke gave me #Error in each,,,so I went back to what I had. thanks

    AOrderSubtotal on Sub 2 only displays the calculation from Sub 1 (where it's called AnOrderTotal). Subform 1 uses the following as it's record source (& query):
    Code:
    SELECT DISTINCTROW [Order Details].*, Clng(([Quantity]*[UnitPrice])*(1-[Discount])*100)/100 AS SubTotal FROM [Order Details];
    In the query are 2 fields; 'Order Details*' and 'Subtotal' Here is the code for subtotal field:
    Code:
    SubTotal: CLng(([Quantity]*[UnitPrice])*(1-[Discount])*100)/100
    There is a subtotal control which uses subtotal as control source, and finally the last control 'AnOrderTotal' which sums up an order:
    Code:
    =nz(Sum([SubTotal]))
    thanks
    Last edited by imrosie; 09-13-07 at 09:58.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •