I have written a small database program with MS ACCESS VBA which is meant to record Daily Savings contributions. It was quite successful but am seeing some lapses in the nearby future which I want to solve now.
In my database, on every 31st Payment cycle, a deduction is made by the system automatically but this is the code I used: - Commission = IIf(PaymentCycle = "31", Rate, IIf(PaymentCycle = "62", Rate, IIf(PaymentCycle = "93", Rate, IIf(PaymentCycle = "124", Rate, IIf(PaymentCycle = "155", Rate, IIf(PaymentCycle = "186", Rate, IIf(PaymentCycle = "217", Rate, IIf(PaymentCycle = "248", Rate, IIf(PaymentCycle = "279", Rate, IIf(PaymentCycle = "310", Rate, IIf(PaymentCycle = "341", Rate, IIf(PaymentCycle = "372", Rate, IIf(PaymentCycle = "402", Rate, IIf(PaymentCycle = "433", Rate, IIf(PaymentCycle = "464", Rate, IIf(PaymentCycle = "495", Rate, IIf(PaymentCycle = "526", Rate, IIf(PaymentCycle = "557", Rate, IIf(PaymentCycle = "588", Rate, IIf(PaymentCycle = "619", Rate, "0"))))))))))))))))))))
This code works with multiples of 31 but what I want to is to write a simple code whereby the system would automatically recognize the MATHEMATICAL multiples of 31 and make deductions or else when the cycle goes beyond 619 according to my code, no deduction would ever be made! I cannot keep adding so many IIf conditions.
If the Payment cycle gets to let say 3720, the system knows that it is a multiple of 31 which is (31*120) and therefore deduction is made.
Hope to find solution here
4 981 jimatqsi 1,271
Recognized Expert Top Contributor
Look at the MOD function. Your solution will look something like this: - if CLNG([PaymentCycle]) MOD 31 =0 then ...
CLNG is required because the MOD function requires numeric inputs. The MOD function returns the remainder of a division.
Jim
Thank you very much Jim. Am going to try this code. I can see it would work. You are my hero for the day!
It was perfect to the prefect core! It worked Perfectly to the prefect core! No need to write long line of unnecessary codes! Thank you you very much Jim!
jimatqsi 1,271
Recognized Expert Top Contributor
You're welcome :). Thanks for the feedback. It's good to know when we've helped solve a problem.
Jim
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: findmadhav |
last post by:
I need a program in C (something like a TSR) which will automatically
press the function key F6, say about every 5 seconds. Can anyone
provide me with an exe of such a program?
Thanks in advance.
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |