IIf statements

R

reterrig

I have a form "A" and two subforms "B" & "C". in the subform "b" i have a
control box "TotalDays" calculating the number of days between two day
fields. In the subform "C" I have the following fields:
"20FreeDaysReefer"
"20From1", "20To1"
"20From2", "20To2"
"20From3", "20To3"
"Rate1"
"Rate2"
"Rate3"

I need the following to be shown in a control box "1st20refreg1" of the "C"
subform for the first row i.e. "20From, "20To1":
If "TotalDays"<"20From1" then "0"
If "TotalDays" Between "FreeDays" And "20To1" then
("TotalDays"-"20FreeDaysReefer")*"Rate1"
If "TotalDays">"20To1" then ("20To1"-"20From1")*"Rate1"
If "20To1" = "over" then ("TotalDays"-"20From1")*"Rate1)
If "Rate1" is null then "0"


I have tried following formula in the Source of the control box
"1st20refreg1" but I get always wrong results i.e. it works when when
"TotalDays" is between "FreeDays" and "To1" but does not work for the other
assumptions:

=IIfIsNull([Rate1];"0";IIf([20To1]="over";"0";IIf([TotalDays]<[20From1];"0";IIf([TotalDays]>=[20From1]
And
[TotalDays]<=[20To1];([TotalDays]-([20From1]-1))*[Rate1];([20To1]-[20From1]+1)*[Rate1]))))

I work on Access 2003 and accepts only semicolons rather than commas

I need your assistance please
Thanks
Peter
 
F

Fred

I noticed that nobody answered. If I may in an attempt to be helpful.

You never really clearly communicated what you are trying to to do. You
seemed to have mentioned it twice, but in each case your statement of what
you're trying to do was defined by failed methods of attempting to do it
instead of being a clear stand-alone statement of what you're trying to do.

You might want to repost.

Sincerley,

Fred
 
R

reterrig

Fred,

I have the following fields in a subform:
20FreeDaysReefer
20From1
20To1
20From2
20To2
20From3
20To3
Rate1
Rate2
Rate3
and the following control boxes:
1st20refreg1
TotalDays


I need the following to be shown in a control box "1st20refreg1" of the "C"
subform :

If "TotalDays"less than "20From1" then "1st20refreg1"= Zero
If "TotalDays" Between "FreeDays" And "20To1" then
("TotalDays" minus "20FreeDaysReefer") multiply by"Rate1"
If "TotalDays"greater than "20To1" then ("20To1" minus "20From1") multiply
by "Rate1"
If "20To1" equals to "over" then ("TotalDays" minus "20From1") multiply by
"Rate1)
If "Rate1" is null then "1st20refreg1"= Zero



Thanks
Peter
 

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