Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004

    Arrow Unanswered: Decimal place problem in query

    Hi - I have a query that contains a number field for inventory quantities. When I run the query it populates appropriately where stock exists and leaves it null if there is no stock. I need to have zeros in the places where there is no stock. So, I created a new field and put in this string to place the zeros in the blank spaces. WK1: NZ([WK],0) This worked great, it gave both the inventory quantities and zeros where there was no stock. The problem is that the field is automatically a text field and I cannot tell it how many decimal places. Right now it shows multiple places. If it was a number field, I could do it but not in a text field. I tried to change it in the report and was unable also. I am assuming I should change the string I put in to get the zeros but I do not know what to change it to.

    Please Help!


  2. #2
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    Use CSng() to "cast" the datatype from text to "single" datatype:

    CSng(nz([WK], 0))

    If you check out "Type Conversion Functions" in the help file, you can see all the different functions available to cast datatypes from one to another.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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