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!

BackColor of textbox won't appear when set

Status
Not open for further replies.

projecttoday

Programmer
Feb 28, 2004
208
US
I have the following code in the On Print event of my report:

If Me.type1 <> "W" Then
Me.txtName1.BackColor = 12632256
Me.txtTime.BackColor = 12632256
Else
Me.txtName1.BackColor = 16777215
Me.txtTime.BackColor = 16777215
End If

And it works for Me.txtName1 but it doesn't work for Me.txtTime. Any idea why? Both are textboxes based on concatenated fields from the input query. 12632256
is gray and 16777215 is white. When type1 is W, txtName1 is gray but txtTime is not.
 
Try conditional formating for the control

select "expression =" [Type1]="W"

HTH

MaZeWorX

Remember amateurs built the ark - professionals built the Titanic

[flush]
 
How are projecttoday . . .

Move the code to the [blue]On Format[/blue] event instead.

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thanks for replying.

Both of these solutions appear to work although I'm sure I tried it in the On Format event earlier and it didn't work. (There must have been something else wrong.) I'm wondering which way is better. It seems to me that a programmer in the future, which could be myself or someone else, might be more likely to look in the events than in conditional formatting and could go crzay not knowing how it was done. Yes, I know if you know Access then you should know conditional formatting but that's if you're perfect. Or not?
 
projecttoday . . .

I'll use [blue]Conditional Formatting[/blue] if I can't accomplish the task any other way or when [blue]Conditional Formatting[/blue] is more direct. [thumbsup2]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top