# Thread: Color Code Based on Odd / Even number

1. ## Color Code Based on Odd / Even number

Is it possible (hard to believe it's not) to color code a field based on the year being an odd or even number?

It's important for the year to stand out in a browse so that the user can more easily differentiate 2012 for 2013, etc., thereby more easily visual identification for the record.

A field containing just the year can be a Numeric, character or date format. In my case, I have it set as a character but only because it's not based on a date field because there is no date field in the table and unless a date field is needed to facilitate this, in which case I could use a calculated field to simply show the current date and format it do show only the year. Doing that, How can I show the odd years to be of one color and the even years to be of another?

Thanks for the suggestions.

2. ## Re: Color Code Based on Odd / Even number

an odd number
mod(number,2) = 1
an even number
mod(number,2) = 0

3. ## Re: Color Code Based on Odd / Even number

Originally Posted by Stan Mathews
an odd number
mod(number,2) = 1
an even number
mod(number,2) = 0
Thanks Stan but I need a bit more. How is the col;or identified with this?

4. ## Re: Color Code Based on Odd / Even number

You are familiar with font equations for fields on forms and columns in browses.

5. ## Re: Color Code Based on Odd / Even number

Well Stan, I looked at you response and that was where I thought it would go but I couldn't see how that would work. Ah, take a look at the Mod function, I thought. After a looksee, That didn't make sense to me either except for two things: 1) Maybe the word 'number' is a reference to a numeric field and 2) Stan says it will work so, give it a try. I changed the Year field to a numeric format and then went to the Other tab of the field Properties, set the colors and the expression: mod(T_Worksite->Year,2)=1. Saved everything, opened the browse and entered an odd number year. What do ya know? It worked. Entered an even number year in the next row and, walla.

Thank you Stan! Once again you've come through with flying colors.

Clarification: While I could have said, "Thanks Stan, that works great!", it might not help newbies. That's not to say Stan was amiss in not providing more details. Not at all. His goal was to point me in the right direction and let me figure it out for myself. I went into detail only because there might be a newbie or two that would have a difficult time with it. So, to Stan I say, "Thanks for your approach!"

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•