Expression Builder: MOD Function

dgkindy

Registered User.
Local time
Today, 15:08
Joined
Feb 22, 2007
Messages
34
trying to use the MOD function in the expression builder but comes up with an error

MOD(5,2)

This is an example. The error reads,

"The Expression you entered containes invaild syntax. You may have entered a comma without a preceding value or identifier"

When I look in the function list, I do not see the function. Any one have any idea?
 
I don't use it very much but I think the syntax is:

x = number1 Mod number2

???
 
trying to use the MOD function in the expression builder but comes up with an error

MOD(5,2)

This is an example. The error reads,

"The Expression you entered containes invaild syntax. You may have entered a comma without a preceding value or identifier"

When I look in the function list, I do not see the function. Any one have any idea?


I think that the syntax for the MOD function is incorrect.

Instead of using MOD(5,2)

Try 5 MOD 2

I did and it returned the correct value of value 1
 
Last edited:
Mod is an arithmetic operator, not a function so look under Operators for the syntax.
 
Last edited:
Are you entering this into the expression builder as part of a query. I have tried both ways and no loving.

Can you cut and past the expression that you got to work from your query.

I think 5 mod 2 is a VB format.
 
I think the format mod() is an excel function. You may need to check your references for excel objects - ?
 
How about you post what you have tried so we can see what you are trying to accomplish. It is not real clear.
 
I think that the syntax for the MOD function is incorrect.

Instead of using MOD(5,2)

Try 5 MOD 2

I did and it returned the correct value of value 1

As I pointed out already. I tried the exact syntax above using MS Access 2003, and the following query worked:

SELECT (5 mod 2)
FROM Table8;

For what it is worth, I agree with RuralGuy. We can provide formula options all day long, but if we do not know what we are building, we will find it difficult to help you choose the correct formula.
 
Straight from the Help File --> Operators --> Arithmetic --> MOD Operator

This example uses the Mod operator to divide two numbers and return only the remainder. If either number is a floating-point number, it is first rounded to an integer.

Code:
Dim MyResult
MyResult = 10 Mod 5	' Returns 0.
MyResult = 10 Mod 3	' Returns 1.
MyResult = 12 Mod 4.3	' Returns 0.
MyResult = 12.6 Mod 5	' Returns 3.

HTH - Bob
 
Last edited:
with big words and pictures!

I haven't explored that website in detail but one article I found on importing spreadsheets into Access well, that was very clever and impressive! it's here:-


Is that your website Zyborgmonkey?
 

Users who are viewing this thread

Back
Top Bottom