We help IT Professionals succeed at work.

Module Programming

kaysoo
kaysoo asked
on
69 Views
Last Modified: 2018-09-05
Hi expert,

I am using Access 2003, I used the following IIF function in query to generate data of growing stage of certain animals, can anyone help me to create a module instead of using query?
I hv to use module function due to a lengthy possibility of the result outcome and query has limited text input allowed. The following is the max allowed in query column.
I need the full module programming code thx.

[DaysOfLife] is calculated from Today's Date minus individual D.O.B. in my existing query

GrowingStage: IIf([DaysOfLife] Between 1 And 15,"1-15 Days",IIf([DaysOfLife] Between 16 And 30,"16-30 Days",IIf([DaysOfLife] Between 31 And 45,"31-45 Days",IIf([DaysOfLife] Between 46 And 60,"46-60 Days",IIf([DaysOfLife] Between 61 And 80,"7cm",IIf([DaysOfLife] Between 81 And 100,"13cm",IIf([DaysOfLife] Between 101 And 150,"17cm",IIf([DaysOfLife] Between 151 And 200,"26cm",IIf([DaysOfLife] Between 201 And 250,"33cm",IIf([DaysOfLife] Between 251 And 300,"42cm",IIf([DaysOfLife] Between 301 And 350,"48cm",IIf([DaysOfLife] Between 351 And 750,"Adult",IIf([DaysOfLife]>750,"Maturity")))))))))))))

Please help to show how to create a Public Function in Module thx.
Comment
Watch Question

John TsioumprisSoftware & Systems Engineer
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Well with so many IIFs you asking for trouble...better to forget them and try to work on a table oriented programming philosophy.
So design a table that will hold conditions and result e.g
ConditionLowLimit ConditionUpperLimit           ResultValue
251                                        300                             42 cm
301                                        350                            48 cm
Then construct a function that reads this table and accordingly produces the value
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
TQVM als315, this is exactly I am looking for, thumbs up!

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.