Age bracket not working

Also, hardcoding brackets like this... not a good idea in general.
Better to store this in a table to "Lookup", just in case you want/must change "31 - 65" to 2 different ones...
31 - 40
41 - 65 or something, having it in a table makes that much easier and doable on the fly instead of having to dig into code.

Also deviding goes before substracting in calculations....
Try
( dtmVisit - dtmDOB ) / 365.25
 
I know about BoDMaS and as this was aircode I think I can be excused.

BTY BoDMaS = Brackets of Division, Multiplication and Subtraction
 
Your are excused David....

The dutch version:
Meneer Van Dalen Wacht Op Antwoord
 
So the poster doesn't want to do an accurate calculation of age and is happy to have errors, but he should note that you cannot calculate a correct age by dividing number of days by - well anything and i am surprised that the more experienced posters here have continued to encourage him.
Also the Nz([DateofVisit],0) construct should not be used but
If Not IsDate(DateofVisit) then etc is the correct approach.

Brian
 

Users who are viewing this thread

Back
Top Bottom