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

Condition Statement 1

Status
Not open for further replies.

jbento

Technical User
Jul 20, 2001
573
US
All,
I have the following code in this section of a report: Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Here is the code:

If Me![newly_opened] = "Lime" Then
Me![iecdNumber].BackColor = vbGreen
Else
Me![iecdNumber].BackColor = vbWhite
End If

If Me![newly_opened] = "Cyan" Then
Me![iecdNumber].BackColor = vbCyan
Else
Me![iecdNumber].BackColor = vbWhite
End If

The problem I have is if "Lime" is chosen from a form the formatting doesn't work on the report, but if I choose Cyan on the form the formatting shows the Cyan color on the report.

The problem is whatever the last condition is, the report captures that.

I want the condition to work if I choose Lime or Cyan.

Now if the condition for Lime was the last condition, then that would work.

How can I fix this problem?

Please help someone.

Thanks in advance.



Jerome Benton
JERPAT Web Designs
GOD Is Good All The Time!!!
 
Using a Select Case statement, you should be able to do this:

Code:
Select Case Me![newly_opened] 
  Case "Lime"
    Me![iecdNumber].BackColor = vbGreen
  Case "Cyan"
    Me![iecdNumber].BackColor = vbCyan
  Case Else
    Me![iecdNumber].BackColor = vbWhite
End Select

John
 
jrbarnett,
That worked beautifully!!!!

Thanks so much, and the STAR is coming.

God bless,

Jerome Benton
JERPAT Web Designs
GOD Is Good All The Time!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top