Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 339
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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