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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Formatting - Just isn't working 1

Status
Not open for further replies.

EllieFant

MIS
May 15, 2001
513
US
I have two fields in my report…one called A and the other called ReqA. I am wanting to change the format of the A field (Font Color, Background Color, and Font Bold properties) if certain conditions are true. This is the code that I have tried and it didn’t work :-(

Select Case Me.A

Case IsNull (A) And IsNull (ReqA) ‘ There are none required and none available
Me.A.ForeColor = vbBlack
Me.A.BackColor = vbYellow
Me.A.FontBold = False

Case Me.A < Me.ReqA ‘ There are more required than available
Me.A.ForeColor = vbWhite
Me.A.BackColor = vbRed
Me.A.FontBold = True

Case me.A = me.ReqA ‘ There are just enough to start up
Me.a.forecolor = vbblue
Me.a.forecolor = vbred
Me.fontbold = true

End Select

What am I doing wrong?

Thanks in advance for your help.
Ellie
**Using Access 97 at work**
**Using Access 2000 at home**

lena.wood@starband.net
 
Hi Ellie,
I am not sure that a case statement is the correct way to handle this. Personally, I would be sticking with traditional &quot;if...then&quot; statements. HTH, [pc2]
Randy Smith
California Teachers Association
 
Thank you Randy!

Ellie
**Using Access 97 at work**
**Using Access 2000 at home**

lena.wood@starband.net
 
Your case syntax just needed a little tweaking (and one correction).

Select Case Me.A
Case Null 'There are none required and none available
If IsNull(ReqA) Then
Me.A.ForeColor = vbBlack
Me.A.BackColor = vbYellow
Me.A.FontBold = False
End If

Case Is < Me.ReqA 'There are more required than available
Me.A.ForeColor = vbWhite
Me.A.BackColor = vbRed
Me.A.FontBold = True

Case Me.A = Me.ReqA 'There are just enough to start up
Me.A.ForeColor = vbBlue
Me.A.ForeColor = vbRed
Me.A.FontBold = True

End Select

It does nothing if A > ReqA. Not sure about the Null because I defined A and ReqA as numeric, and couldn't test that one.
Karl
 
oops, last case:

Case Me.ReqA 'There are just enough to start up Karl
 
In addition, when I cut an pasted your code, the &quot;‘&quot; you were using was not recognized as a &quot;'&quot; (single quote) indicating a comment and was giving errors based on that. Karl
 
Thank you Karl...I typed out my letter in word before posting the question. Word makes funny quotes so I always have to change them if I paste it into Access.

I will give this a try when I return to work on Monday. I will let you know how it goes. Thanks SO much.
Ellie
**Using Access 97 at work**
**Using Access 2000 at home**

lena.wood@starband.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top