Can't Format a field in a Query thats Calculated

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DJRhino1175
    New Member
    • Aug 2017
    • 221

    Can't Format a field in a Query thats Calculated

    Code:
    ProductionLost: Nz(([UnplannedDowntime]+[sumofchangeoverminutes])*[AvgOfCalcLineSpeed],0)
    I can put in the format as Standard, but it will not allow me to change the decimal place.

    What did I do wrong?

    Thanks for the help.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32633

    #2
    As you've used NZ(), it doesn't realise that the result is numeric. NZ() returns a Variant value.

    Try instead :
    Code:
    ProductionLost: CDbl(Nz(([UnplannedDowntime]+[sumofchangeoverminutes])*[AvgOfCalcLineSpeed],0))
    Another type-conversion function may suit you better but this one will work and illustrates the point well enough.

    Comment

    • DJRhino1175
      New Member
      • Aug 2017
      • 221

      #3
      Thank you, this worked awesomely. I'll need to remember that one.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        Any time DJ :-)

        Glad I could help.

        Comment

        Working...