Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jul 2003
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Totals In A Form Footer (Access 2002)

    I created a text box that is located in a form footer; I'm trying to sum a text box that was created in the form detail and the control source is "=IIf([HrlyRateOVR] Like 0,[Hrs921]*[HrlyRate],[Hrs921]*[HrlyRateOVR])" the text box is called "AccrualAmtGrs"; text box in the footer has the control source "=Sum(Nz([AccrualAmtGrs]))". When I open the form the text box in the footer displays "0.00". However there are values in the form detail.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Totals In A Form Footer (Access 2002)

    Like 0 is not a valid expression, Like always compares to a string value, and that value should contain a wildcard character "*" or "?". What exactly are you trying to calculate?

    Apart from that, you should use the expression in the sum, not the control:

    =Sum(Nz(IIf([HrlyRateOVR] Like 0,[Hrs921]*[HrlyRate],[Hrs921]*[HrlyRateOVR])))

  3. #3
    2 Star Lounger
    Join Date
    Jul 2003
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Totals In A Form Footer (Access 2002)

    I'm trying to perform a calculation based on the value of two fields; the default value of both fields are "0" zero; thus only one field can contain a number other than zero. Bottom Line; I just want to display a total on the form footer for all the detail records. However the control source is a calculated field in the form detail. Thanks for your help. Can you use "Is 0" ("Zero")?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Totals In A Form Footer (Access 2002)

    I don't understand "thus only one field can contain a number other than zero". Why can't both fields contain a number other than zero?

    You can compare to zero simply by using = 0; I don't think the Nz does anything here.

    =Sum(IIf([HrlyRateOVR] = 0,[Hrs921]*[HrlyRate],[Hrs921]*[HrlyRateOVR]))

Posting Permissions

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