Results 1 to 12 of 12
  1. #1
    Join Date
    Mar 2004
    Posts
    19

    Unanswered: Hide any value = to 0 in a text box on a form

    Please help I am able to do all the calculations I need as long as I make certain text boxes default value 0 but I do not want these boxes to show a 0 if nothing is put in them. Can I hide the text box if the value is 0?

    Please help I am running out of time.

  2. #2
    Join Date
    Jul 2003
    Posts
    6
    If you get it figured out, I need the answer. I've been working on the same thing all day.
    tried this in Access 2002 in the Control Source

    =IIf([myfield]=0 Or IsNull([myfield]), "", [myfield])

    doesn't print anything.

  3. #3
    Join Date
    Jul 2003
    Posts
    6

    Red face

    I was able to resolve my problem by putting NULL values in my table that the report was using. I didn't realize that Access puts a default value of zero in a numeric field.

  4. #4
    Join Date
    Jul 2003
    Posts
    6
    I download your file, but nothing was in it.

  5. #5
    Join Date
    Mar 2004
    Posts
    19
    Sorry posted the wrong zip file. Here is the correct attachment.
    Attached Files Attached Files

  6. #6
    Join Date
    Mar 2004
    Posts
    19
    Still unable to get rid of the zeros starting to get a headache from banging my head up against the wall.

  7. #7
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    As mentioned, your attached file contains only the structure for one table, no data, and no forms...?

    Also, do not set the default value to 0 if you want them to show up blank.

  8. #8
    Join Date
    Mar 2004
    Posts
    19
    I downloaded the zip file and there is on table and one form. Not sure why you didn't recieve the form? If you got the form you would understand more on what I am trying to do.

    I am by no means a access expert so I am using a form kind of like a excel speadsheet. Where I am trying to calculate Extended Cost (Ecost) and Total Cost (Tcost) from 10 different items with (Qty) and (Cost).

    example

    Qty1 Cost1 [Ecost1=Qty1*Cost1]
    Qty2 Cost2 [Ecost2=Qty2*Cost2]
    Qty3 Cost3 [Ecost3=Qty3*Cost3]
    ect.
    then
    Total Cost = [Tcost=Ecost1+Ecost2+Ecost3+ect.]

    This works fine as long as there is a value in every field that is why I need the default value set to 0. But I don't want the 0's to be visable.

    If there is a way to make the 0's non visable that would be ideal. Or if some has a better way of doing this that would be great.

  9. #9
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    instead of defaulting to 0 (which is sometimes not a reasonable default: consider AGE=0), leave the default as null.

    for your calculations (which wont like null at all) use:
    Ecost1=nz(Qty1, 0) * nz(Cost1,0)

    izy
    currently using SS 2008R2

  10. #10
    Join Date
    Jul 2003
    Posts
    6
    Originally posted by sbook73
    I downloaded the zip file and there is on table and one form. Not sure why you didn't recieve the form? If you got the form you would understand more on what I am trying to do.

    I am by no means a access expert so I am using a form kind of like a excel speadsheet. Where I am trying to calculate Extended Cost (Ecost) and Total Cost (Tcost) from 10 different items with (Qty) and (Cost).

    example

    Qty1 Cost1 [Ecost1=Qty1*Cost1]
    Qty2 Cost2 [Ecost2=Qty2*Cost2]
    Qty3 Cost3 [Ecost3=Qty3*Cost3]
    ect.
    then
    Total Cost = [Tcost=Ecost1+Ecost2+Ecost3+ect.]

    This works fine as long as there is a value in every field that is why I need the default value set to 0. But I don't want the 0's to be visable.

    If there is a way to make the 0's non visable that would be ideal. Or if some has a better way of doing this that would be great.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    try this IIf([Qty1] Is Not Null, [Ecost1=Qty1*Cost1], Qty1)

    this means the value returned if Qty1 is Null s/b a Null value, right? Otherwise, it will do the calculation.

    let me know....I'm running a test

  11. #11
    Join Date
    Jul 2003
    Posts
    6
    Originally posted by izyrider
    instead of defaulting to 0 (which is sometimes not a reasonable default: consider AGE=0), leave the default as null.

    for your calculations (which wont like null at all) use:
    Ecost1=nz(Qty1, 0) * nz(Cost1,0)

    izy
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~``
    izy, your right. I posted b4 seeing your reply.

  12. #12
    Join Date
    Mar 2004
    Posts
    19

    Talking

    Thank you so much IZYRIDER it works just as I wanted it to.

    I actualy used the nz(Ecost1,0) with in my Total Cost section and it works perfectly.

    Now there are no 0's in any of the Qty Cost or Ecost fields and the calculations work great.

    Thank you again.

Posting Permissions

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