Re: Complicated update

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Then just add the missing ) in:

DSum("[Miles]","Mileage" - 10000

since you cannot subtract 10000 from the string Mileage.


Vanderghast, Access MVP



"Ashers" <Ashers@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:DBD3C675-ABA1-450B-BC7D-BE6F66C3B627@xxxxxxxxxxxxxxxx
Almost,

but it is

0.25 * ( DSUM() - 10000 ) + 0.4*(miles - ( DSUM() - 10000))

If I explain, this previous total mileage =9500, this travel= 600.
So the claim would be
0.25 * (10100-10000) + 0.4 * (600-(10100-10000))
or 0.25 * 100 + 0.4 * 500


I hope this makes sense?

Ashley

"Michel Walsh" wrote:



It seems that the last argument must be:

0.4 * (10000 - DSUM() ) + 0.25*( miles - 10000 - DSum())

which is, after simplification:

0.15*10000 + 0.25* miles -0.15*DSum("miles", "mileage")


instead of the actual

(DSum("[Miles]","Mileage" -
10000)*0.25)+(([Miles]-(DSum("[Miles]","Mileage") - 10000))*0.4)
^
missing ) here, I think


Note that I haven't checked the ( and ) matches.




Vanderghast, Access MVP



"Ashers" <Ashers@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:92D762E4-E93C-4203-8955-88C663F14608@xxxxxxxxxxxxxxxx
I am helping my brother with his mileage claims database, for under 10K
miles
you get one rate and another for over 10K. There was a simple update
that
worked with one exception and that was the job that crossed over from
one
rate to another.

I have written the code below, but Access doesn't like it and after a
couple
of hours looking I can't see why. Any help will be greatly appreciated.

UPDATE [Cost Update 1] SET [Cost Update 1].Cost
=IIf(DSum(("[Miles]","Mileage")-[Miles])>=10000,([Miles]*0.25),IIf(DSum("[Miles]","Mileage")<10000,([Miles]*0.4)),(DSum("[Miles]","Mileage"
- 10000)*0.25)+(([Miles]-(DSum("[Miles]","Mileage") - 10000))*0.4));





.



Relevant Pages

  • Re: OT: Math Problem
    ... Subtract a**2 from both sides of the equation, ... the professor frowns, leaves the class for 10 minutes... ...
    (comp.lang.cobol)
  • Re: column count
    ... Maybe I'm missing something, but if you already have the column numbers, why ... can't you just subtract one from the other to get number of columns? ... (email address is on the web site) ... of letters? ...
    (microsoft.public.excel.programming)
  • Re: Subtracting cells
    ... it was the CTRL that I was missing. ... Office book and I could not find it in there I guess it probably is as it is ... > want to subtract E from D in all lines. ...
    (microsoft.public.excel.newusers)
  • Re: MISSING NUMBER
    ... Mensanator wrote: ... One number is missing, how to find ... Adding the number then subtract N/2 may not be possible ... Use a math library where "too big to store" isn't an issue. ...
    (comp.programming)