Days calculation going haywire

G

Guest

I ran an Office update a couple of days ago, and suddenly a formula is
producing an incorrect answer intermittently:
Due Date: [From
date]-IIf([Country]="",IIf([nights]>20,90,60),IIf([nights]>10,90,60))

In most cases the calculation is correct, but about once in 5 cases, it's
calculating a difference of 30 days instead of 60. You will notice there is
no mention of 30 in the formula. I've gone back to the confirmation letters
that printed out from this query, and they are all correct until the one I
sent out today (the first one I've sent out since the update), but the values
in the query are now incorrect. It looks like all the From dates are in
December through February, where the calculation is incorrect.
 
T

TC

It's a bit hard to comment on this, unless you can cite an exact
example of where it went wrong. And also show the SQL from the query
concerned.

Access queries just don't go bad, & produce the wrong information. Not
to be rude, but, it is 99.9% certain that it is doing just what you
asked it to.

HTH,
TC (MVP Access)
http://tc2.atspace.com
 
G

Guest

Well, it turns out it's not the query that has it wrong, it's the value in
the form, which gets the value of Due Date from the query. How can this
happen?
 
G

Guest

Never mind. I decided, about a month ago, to create a new query, based on
the previous one, but only including rows with a From date within the past 12
months. Evidently I decided also to "simplify" the due date calculation to
be Due Date: [From date]-(30+(30*Int([nights]/7))), so now anyone that books
less than a week gets a break on the due date. NOT what I intended.
Groan. I really shouldn't be doing this past my bedtime!

Numfric said:
Well, it turns out it's not the query that has it wrong, it's the value in
the form, which gets the value of Due Date from the query. How can this
happen?

Numfric said:
I ran an Office update a couple of days ago, and suddenly a formula is
producing an incorrect answer intermittently:
Due Date: [From
date]-IIf([Country]="",IIf([nights]>20,90,60),IIf([nights]>10,90,60))

In most cases the calculation is correct, but about once in 5 cases, it's
calculating a difference of 30 days instead of 60. You will notice there is
no mention of 30 in the formula. I've gone back to the confirmation letters
that printed out from this query, and they are all correct until the one I
sent out today (the first one I've sent out since the update), but the values
in the query are now incorrect. It looks like all the From dates are in
December through February, where the calculation is incorrect.
 

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