M
Mansoor
How should I write the following:
IIf([Number] is even,0,1)
Thanks in advance mansoor
IIf([Number] is even,0,1)
Thanks in advance mansoor
Either use bit-masking or modulo-division:How should I write the following:
IIf([Number] is even,0,1)
Stefan said:hi,
Either use bit-masking or modulo-division:How should I write the following:
IIf([Number] is even,0,1)
CLng([Number]) And 1 = 1
CLng([Number]) Mod 2 = 1
Both are testing for odd numbers. Depending of you numbers data type you
don't need the CLng() conversion.
mfG
--> stefan <--
How should I write the following:
IIf([Number] is even,0,1)
Thanks in advance mansoor
John Spencer said:I think you will have to include parentheses to ensure the proper order of
evaluation in the statement.
(CLng([Number]) And 1) = 1
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
.Stefan said:hi,
Either use bit-masking or modulo-division:How should I write the following:
IIf([Number] is even,0,1)
CLng([Number]) And 1 = 1
CLng([Number]) Mod 2 = 1
Both are testing for odd numbers. Depending of you numbers data type you
don't need the CLng() conversion.
mfG
--> stefan <--
How should I write the following:
IIf([Number] is even,0,1)
Thanks in advance mansoor
You don't need an IIF at all: just use the MOD operator, which returns the
remainder after a divison. [Number] MOD 2 will be equal to 0 if Number is
even, 1 if it is odd.
Thank you Mr Spencer
but I need this condition
IIf([Number] is even,0,1)
as a criteria to the following column
[FromNo] Mod 2
John Spencer said:I think you will have to include parentheses to ensure the proper order of
evaluation in the statement.
(CLng([Number]) And 1) = 1
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
.Stefan said:hi,
On 13.02.2010 09:55, Mansoor wrote:
How should I write the following:
IIf([Number] is even,0,1)
Either use bit-masking or modulo-division:
CLng([Number]) And 1 = 1
CLng([Number]) Mod 2 = 1
Both are testing for odd numbers. Depending of you numbers data type you
don't need the CLng() conversion.
mfG
--> stefan <--
John Spencer said:You can use either one of these expression to get the desired result
IIF(([Number] Mod 2) = 0,0,1)
Or
Abs([Number] Mod 2)
They both will return 0 or 1 if there is a number value in the number field.
There is a slight difference it the number field is NULL. The first
expression will return 1, the second will return Null.
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
.Thank you Mr Spencer
but I need this condition
IIf([Number] is even,0,1)
as a criteria to the following column
[FromNo] Mod 2
John Spencer said:I think you will have to include parentheses to ensure the proper order of
evaluation in the statement.
(CLng([Number]) And 1) = 1
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
Stefan Hoffmann wrote:
hi,
On 13.02.2010 09:55, Mansoor wrote:
How should I write the following:
IIf([Number] is even,0,1)
Either use bit-masking or modulo-division:
CLng([Number]) And 1 = 1
CLng([Number]) Mod 2 = 1
Both are testing for odd numbers. Depending of you numbers data type you
don't need the CLng() conversion.
mfG
--> stefan <--
.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.