Decimal places and formatting within query! aargh!

Joined
Jun 15, 2012
Messages
11
Reaction score
0
Hello everyone! I'm new to the forum, but I've been lurking about for a few weeks yet. I am having a recurring problem that I would like a little insight on.

I have a database that is utilizing a query; this query is pulling two date ranges from a table. I want to find the difference between the two dates, which is easy enough. Now here's the issue:

It has to be in fractions of a day- so if an operation only takes 3 hours, I need it to say .13 (for .125 days). No matter how many times I specify that the two columns in the table are "General Dates" and the expression is a number, it *WILL NOT* recognize that I wish for it to have two decimal places, it always reverts to something like 1.258373494532334E-2 and the like, instead of .01. :(

I've tried formatting, trying to force it to treat as a value (Val()), and I just can't get it to respond. What do you think?

[DateClosed] set as General Date, tbl_Q
[Date_Entered] set as General Date, tbl_Q

Expr1: [DateClosed]-[Date_Entered]
TotalCycleTime: Round([Expr1])

I'm using TotalCycleTime for the time being to set is as 0 since the extra values are obnoxious on the report. I had it set as this for a while as well:

Expr2: IIf([DateClosed]-[Date_Entered]<1,Round(([DateClosed]-[Date_Entered]), DateClosed]-[Date_Entered]).

Previous checks are performed to make sure that DateClosed and Date_Entered are not null.

Let me know what you think, there's got to be something silly that I happen to be missing. Thanks everyone.
 
Joined
Jun 15, 2012
Messages
11
Reaction score
0
Well, with a bit of aimless perusing on the web, I have figured it out!

Regardless of how it was formatted, it decided that it was going to stick to the full length of significant figures with no input from the "Decimal Places" tab. So, to combat this- I switched it to this-

Expr1: [DateClosed]-[Date_Entered]
TotalCycleTime: Abs([Expr1])
(Property Sheet) Format ==> "Fixed"

When set to Fixed, decimal places suddenly work. Round() will likely work just fine, just not for my instance. Since none of the numbers will be negative (all dates) I can just borrow the Abs() format to set to fixed, otherwise it will not allow me to select a format.


This worked, and I will refine it later to incorporate the Round() function where it is needed.

Well, that did it for me. Hope it helps someone :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top