When using the Roundup command in Microsfot Access I get an error, "Undefined function roundup' in expression". Does anyone know of an easy method to round up rather than the default down.
Example: 1.3 should equal 2.
Any help is appreciated.
Thanks
The field name I have is AgeF and I wld like this field to ROUNDUP to the highest rather than down. How wld i code it in the above given example of yours :
Private function RoundUp(vrRoundedNumber as variant) as variant
if vrRoundedNumber / vrRoundedNumber <> 1 then
RoundUp = Round(1 + vrRoundedNumber , 0)
else
vrRoundedNumber = round(x,0)
end if
End function
Also where do I put the call for this field.. is it at Lost focus?
when the user inputs the raw scroes I wld like the calc I use to show the rounded age for the client. I am not great at coding so i am a bit stuck. Cld u possibly help me, it wld be greatly appreciated. and can I use it in a form Class module.
Am I am safe in saying that this is what it will look like or If I am wrong pls feel free to correct me
Private function RoundUp(AgeF as variant) as variant
if AgeF / Agef <> 1 then
RoundUp = Round(1 + AgeF , 0)
else
AgeF = round(x,0)
end if
Sorry for being a nuisance. I dont quite understnad , so can you lease help me.
This is my scenario.
I have a field called AgeNow which is in yrs and mths. Lets say the Yrs is 2 and the Mths is 8 I want the system to roundup and say the age at test was 3.
another ex: if the Yrs is 1 and the MThs is 3 I still want the numbers to get rounded up.. not down. So in this case it wld be 2.
the field that rec. the rounded UP number is called AgeNew.
The clients age cane be anything.. 1y.6 m; or 2y.5m; or 3y;2m
In this case how would your function work here.. can u please guide me.. can u use my field names as an example and tell me what goes where. thanks so much for your help.
What exactly does the data look like in the field AgeNow?
is it really
1y.6 m
2y.5m
3y;2m
with periods OR semi-colons and perhaps some spaces? If so, the function above won't work because it's based on the age being a number. How come you are saving the age in this format? Usually you'd just get the birth date and subtract from the current date, or some other date; what i mean is you calculate the age on-the-fly, since it changes daily. You just store the birth date since it never changes.
In any case, if you really do store the age and the reason for that turns out to be a valid one, the first thing i'd do is split that data up into two fields, AgeYears and AgeMonths so you can do calculations on it. Trying to do calcuations on a field that has no standard format, meaning someone can type anything they want in there, will be a nightmare.
Just my opinion....g
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.