Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Background color for a textbox

Status
Not open for further replies.

sirpelon

Programmer
Sep 13, 2001
19
0
0
MX
Hi

I need to create a report that shows a year calendar, and highlights a date on each month, i have a table with the dates that need to be highlighted, right now I'm able to show the calendar but my problem is that i don't know how to highlight the date. I put all on the report footer section. Basically the months have 42 textboxes that are ready to show the day number based on formulas.

For the highlight I have tried with a conditional formula on the textboxes that evaluates if the corresponding date is equal to the specified date taken from the table if this is true I specify the new backgroud color and if not I specify white color, but besides this i need to control that the color changes only onces, for example for january I need to highlight the Jan 1st. date, so with the formula the color changes to the specified color but when the formula evaluates again the color goes back to white and I don't know how to put an extra condition to check if the color has been already changed then do nothing.

I'm using crystal reports that cames with vb .net 2005

Thanks.
 
Use DatePart to get values for month and day.

DatePart ("m", {date1}), giving a number based on the calendar. It is possible to change the first day of the week, when dealing with week intervals.

Choices are yyyy, Year. q, Quarter (3-month period). m, Month. y, Day of year. d, Day. w, Weekday. ww, Week (7-day period). Months are whole calendar months, 01 to 12

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Please show the contents of your current formula and also explain the logic you are trying to implement. Do you mean that after the first time per month that the formula meets the criterion that no more days should be highlighted even if they meet the criterion? Or?

-LB
 
Thanks both for your interest...

lbass
The calendar is made according to a hint from the Chelsea Tech. site :), the difference is that i have to highlight two dates on each month, for example in january i have to highlight the first and the fifth day, i put the formula like N - @startday to get the day number, i put a textbox on the back with a format condition in the background color like:

If Date ({?Year},{?Month},{@SU_WK1}) = {calendars_dates.calendar_date} And {calendars_dates.type} = "RE" Then
Color (240, 230, 140)
Else
DefaultAttribute

So when the condition is true the color changes... but when the next calendar_date is compared the color returns to the DefaultAttribute...

Right now I'm trying to solve this with adding a global variable to the condition like:

Global BooleanVar _RE_SU_WK1;
If {@SU_WK1} > 0 Then //Valid day number?
If Date ({?Year},{?Month},{@SU_WK1}) = {calendars_dates.calendar_date} And {calendars_dates.type} = "RE" Then
Color (240, 230, 140)
Else
If _RE_SU_WK1 = True Then //The color was changed once?
Color (240, 230, 140)
Else
DefaultAttribute
Else
DefaultAttribute

Seems to work but I'm testing it yet...
 
I think you just need to stretch the formula field that defines the calendar day (N-{@startday}) to match the borders of the "day box", and then select the formula->format field->color->background->x+2 and enter:

if currentfieldvalue in [1,5] then
cryellow else
defaultattribute

I'm not following what you are using to determine the coloring criteria, but if it's a field, then you would substitute that in the formula:

if currentfieldvalue = {table.field} then
cryellow else
defaultattribute

...and also add any other criteria to the formula.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top