IIF function and dates

eshai 1 Reputation point
2024-03-17T10:42:21.8733333+00:00

Hello

I was asked to make a change in the code I am currently calculating how much a student should pay

The students have an arrival date, from here it automatically calculates for them the amount according to what was agreed monthly and the days of the month according to the departure date, the default of which is the first of the current month, that way I know how much payment was received and if there is a debt

the current code

=IIf(IsNull([Form]![extday]),"0",[amount]/30*[Form]![extday])

where [extday] is the calculation of how many days from the month by the Diff2Dates function What they asked me now that from 01.04.2024 to 15.04.2024 is a full charge of a month and from 16.04.2024 to 31.04.2024 is half a charge of the month and and so on But before 01.04.2024 the calculation is according to the old code new code

=IIf([startdate] Between #01/04/2024# And #15/04/2024#,[amount],IIf([startdate] Between #16/04/2024# And #31/04/2024#,[amount]/2,[amount]/30*[extday]))

The question is how do I make the rule in the code apply to the following months and the following years because according to the code it is limited to 04.2024

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
881 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.