Problem with if

Sharon Hague

Registered User.
Local time
Today, 11:29
Joined
Jul 10, 2003
Messages
138
Hi All

I have a problem with some coding I have entered into a report I have created.

My report comprises of 3 fields - MyDate, MyDay and Overtime.

I want the report to show Saturdays in red, therefore I have entered the following code into the on format part of my detail part of my report: -

If Me.MyDay = 7 Then
Me.MyDay.FontBold = True
Me.MyDay.ForeColor = vbRed
Else
Me.MyDay.FontBold = False
Me.MyDay.ForeColor = vbBlack
End If

When I run the report everything is displayed in black.

What am I doing wrong?

I'd appreciate anybody's help on this.
 
Try placing you code in the report's OnFormat event.
 
llkhoutx & Pat

Thanks for you reply, however this is where I have enter my code which is why I don't understand why it is not working.

Any ideas?
 
Run thrtough your code with the Debugger on. I;m often surprised that my code isn't doing what I think it's doing.
 
Rich

MyDay is displaying Sat as its format is ddd.

I have tried changing 7 to "Sat" in my code but it still doesn't like it.

Any ideas?
 
If (WeekDay(Me.MyDate) = 7) Then
Me.MyDay.FontBold = True
Me.MyDay.ForeColor = vbRed
Else
Me.MyDay.FontBold = False
Me.MyDay.ForeColor = vbBlack
End If
 

Users who are viewing this thread

Back
Top Bottom