Expression Builder: MOD Function (1 Viewer)

dgkindy

Registered User.
Local time
Today, 19:36
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?
 

KenHigg

Registered User
Local time
Today, 19:36
Joined
Jun 9, 2004
Messages
13,327
I don't use it very much but I think the syntax is:

x = number1 Mod number2

???
 

MSAccessRookie

AWF VIP
Local time
Today, 19:36
Joined
May 2, 2008
Messages
3,428
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:

RuralGuy

AWF VIP
Local time
Today, 17:36
Joined
Jul 2, 2005
Messages
13,826
Mod is an arithmetic operator, not a function so look under Operators for the syntax.
 
Last edited:

dgkindy

Registered User.
Local time
Today, 19:36
Joined
Feb 22, 2007
Messages
34
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.
 

KenHigg

Registered User
Local time
Today, 19:36
Joined
Jun 9, 2004
Messages
13,327
I think the format mod() is an excel function. You may need to check your references for excel objects - ?
 

RuralGuy

AWF VIP
Local time
Today, 17:36
Joined
Jul 2, 2005
Messages
13,826
How about you post what you have tried so we can see what you are trying to accomplish. It is not real clear.
 

MSAccessRookie

AWF VIP
Local time
Today, 19:36
Joined
May 2, 2008
Messages
3,428
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.
 

raskew

AWF VIP
Local time
Today, 18:36
Joined
Jun 2, 2001
Messages
2,734
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:

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:36
Joined
Jul 9, 2003
Messages
16,245
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

Top Bottom