• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 345
  • Last Modified:

Textbox background color (report)

Hi experts !

I'd like to know how I could change, with Access97, the background of a textbox placed on a report. In fact, it'd be conditionnal, like if text1 <> text2, then text2.background = new color.

Thanks, code needed !
0
rouxjean
Asked:
rouxjean
  • 4
  • 3
  • 3
2 Solutions
 
CrossWiredCommented:
   If MsgBox("Yes or No", vbYesNo) = vbYes Then
        Me.DESCR.BackColor = 0
        Me.DESCR.BackStyle = 1
    End If


Put this on the OnOpen event of your report, and of course set the condition to whatever you need

0
 
CrossWiredCommented:
what do you mena by text1 <> text2 what will you be comparing?
0
 
flavoCommented:
try (not sure never done it)

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  If Me.txt1 <> Me.txt2 Then
    Me.txt1.BackColor = vbBlue
  Else
    Me.txt1.BackColor = vbRed
  End If
End Sub
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
rouxjeanAuthor Commented:
CrossWired : The report is based on a table, so for each record, if the text1 content is different than the text's 2 contents...I need to change the color to text2. I don't have the backcolor propertie...
0
 
flavoCommented:
rouxjean,

This is one of those "tricky" ones..

The text box control does have the BackColor property, just that the intelisense doesnt show it, so you cant use the list that pops up, youll have to type the whole word by hand.

Good Luck!

Dave
0
 
rouxjeanAuthor Commented:
tried: Me.Texte42.BackColor = vbRed on the form onload event...its still white ! I'd also like to use RGB if possible...
0
 
CrossWiredCommented:
be sure to change the style to solid vice Transparent
0
 
flavoCommented:
report or form??

if its a report you need to use Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

vbBlue is a constant provide by access (actually = to 16711680)

To use RGB use

Me.Texte42.BackColor = RGB(red, green, blue)

replace red, green and blue above for your values (must be between 0-255)


Dave
0
 
rouxjeanAuthor Commented:
Last thing...maybe off-topic but i can't use Me. because it can refer to query expressions of form controls. How can I ensure it works ?
Thanks !
0
 
flavoCommented:
is it a form or report..

If its a form you should be using Form_Current(), report use Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

not sure what you are asking

CrossWired,

Ill leave this up too you, its getting WAY to late (1:15AM, need to get up in 4:30 hours)

Later!

Dave
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 4
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now