math functions in VB

  • Thread starter Thread starter Alex
  • Start date Start date
A

Alex

Hello,

It looks like the math functions such as Min(), Max(), and
Mod() are not working under VB in MS Access. Is there any
way to make them working there?

Thanks
 
Alex said:
It looks like the math functions such as Min(), Max(), and
Mod() are not working under VB in MS Access. Is there any
way to make them working there?


There is mo Mod function, it's an operator. E.g. 14 Mod 6
is 2

The Min and Max functions in Access are aggregate functions
that operate on a column in a query. In my experience,
there is little need for the math functions you're asking
about, but if you really need them, they're easy enough to
create yourself:

Public Function MinOfList(ParamArray vValues() As Variant) _
As Variant
Dim vX As Variant
MinOfList = vValues(0)
For Each vX In vValues
If vX < MinOfList Then MinOfList = vX
Next vX
End Function

Public Function MaxOfList(ParamArray vValues() As Variant) _
As Variant
Dim vX As Variant
MaxOfList = vValues(0)
For Each vX In vValues
If vX > MaxOfList Then MaxOfList = vX
Next vX
End Function
 
Thanks a lot, Marsh.
-----Original Message-----



There is mo Mod function, it's an operator. E.g. 14 Mod 6
is 2

The Min and Max functions in Access are aggregate functions
that operate on a column in a query. In my experience,
there is little need for the math functions you're asking
about, but if you really need them, they're easy enough to
create yourself:

Public Function MinOfList(ParamArray vValues() As Variant) _
As Variant
Dim vX As Variant
MinOfList = vValues(0)
For Each vX In vValues
If vX < MinOfList Then MinOfList = vX
Next vX
End Function

Public Function MaxOfList(ParamArray vValues() As Variant) _
As Variant
Dim vX As Variant
MaxOfList = vValues(0)
For Each vX In vValues
If vX > MaxOfList Then MaxOfList = vX
Next vX
End Function
 
Back
Top