423,350 Members | 2,519 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,350 IT Pros & Developers. It's quick & easy.

Can't Format a field in a Query thats Calculated

P: 92
Expand|Select|Wrap|Line Numbers
  1. 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.
2 Weeks Ago #1

✓ answered by NeoPa

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

Try instead :
Expand|Select|Wrap|Line Numbers
  1. 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.

Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,007
As you've used NZ(), it doesn't realise that the result is numeric. NZ() returns a Variant value.

Try instead :
Expand|Select|Wrap|Line Numbers
  1. 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.
2 Weeks Ago #2

P: 92
Thank you, this worked awesomely. I'll need to remember that one.
2 Weeks Ago #3

NeoPa
Expert Mod 15k+
P: 31,007
Any time DJ :-)

Glad I could help.
2 Weeks Ago #4

Post your reply

Sign in to post your reply or Sign up for a free account.