Changing Background Color of Record Only

  • Thread starter Thread starter AngelT
  • Start date Start date
A

AngelT

Guest
Well, in browsing what has already been posted, I'm afraid my answer seems to be no here, but want to toss my request out there again just in case an answer has fallen from the sky for me. :c)

I have a continuous form, which if a particular value exists in a field, I would like the background color for that record only, to change to Red.

I am in Access '97 still. :c\

If the answer is no, I assume I'll have to go the hard way and code each field background to change???? YIKES!!

Thanks for your input.

AngelT () :c)
 
I know what you are looking for, but alas I to am in search this answer. Where a date field for example displays black, yellow or red depending on age, but the problem again is that the first record drives the outcome of each record on a countinuous form.
I've been in search for five years or better, and still no answer.

Keep up the fight.
 
Calvin!! That does not give me much encouragement!!! *Hahaha* Well, I've been toying with a few idear's all afternoon here, and still no luck. Sure looks - at face value - like it should work. Darn thing!!!

Each record is one of it's own, so you'd think each detail line (ie. background) could be formatted individually. *scratching head in deep thought again*

This is the closest that I've gotten.......at least the wave link I'm on:

Private Sub Form_Current()

If Forms!Main!MainsSubForm!AREA.Value = ("03") Or ("04") Or ("07") Or ("09") Then
Forms!Main!MainsSubForm.Detail.Back_Color = RGB(255, 0, 0)
End If
End Sub

Of course I am receiving a run time error (438 - Object doesn't support this property or method).

I find it very difficult to give up. When I want to do something, by golly the darn thing should let me do it!! *Hahaha*

Well.....thanks for your response; and may the force be with you!! ;c)
 
You have to use a cheat, add an unbound textbox to the detail section, set its width to the width of the detail section, set its control source to =Iif([YourField]=Something,True,False) set the format to say XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, set the fore and back colours and properties to suit
 
Try:

If Forms!Main!MainsSubForm!AREA.Value = ("03") Or _
Forms!Main!MainsSubForm!AREA.Value = ("04") Or _
Forms!Main!MainsSubForm!AREA.Value = ("07") Or _
Forms!Main!MainsSubForm!AREA.Value = ("09") _
Then
Forms!Main!MainsSubForm.Detail.Back_Color = RGB(255, 0, 0)
End If


but not sure it is your answer.

Why "("03")" ? What is the .Value type, string?, integer? are you tring to convert to one from another?

hmmmm...
 
More relevant to Calvin (and just rubbing it in for you AngelT)

Calvin,

If you use Acc2000 or AccXP, have you used conditional formatting to solve you problem?

I use conditional formatting on continuous and datasheet forms with few issues.

Brad.
 
Brad,
Nope, haven't tried conditional formatting but I'll give it a look. But it's just as relevant to me with a couple legacy 97 apps that i still support.

Rich,
I tried your 'cheat' but I'm still missing something, below is iif statement in the control source of Text2 textbox

=IIf(CLng([Field2])<5,[Text2].[ForeColor]=255,[Text2].[ForeColor]=0)

I inserted the X's into the format property but nada. What's the format property have to do with it?
 
Here is an example of the method refered to by Rich.

It sets the highlight based on the MetRequirements field in the Table.

Regards
Chris
 

Attachments

Calvin,

The "03" is a string. Not a necessary calculation field, only identifier. No need for conversion.

I will take a couple of these inputs and give them a shot.

Thank you for your responses everyone!! :c)
 
ChrisO said:
Here is an example of the method refered to by Rich.

It sets the highlight based on the MetRequirements field in the Table.

Regards
Chris

This is great, thanks Chris!

It's very strange how it will only work when you add the following code:

Private Sub Form_Open(Cancel As Integer)
Me.txtHighLight.FontSize = 24
Me.txtHighLight.FontName = "Terminal"
Me.txtHighLight.Format = ";" & Chr(34) & String(250, 219) & Chr(34)
End Sub

I put the format string into a message box and the result was plain wierd! lol

Anyway, for the benefit of other, this is how you do it...

'Create an empty text box around what you want to highlight. Set all to transparent. Set the foreground
'to the colour of the hightlight.

'Add the condition of the hightlight in the box's control source, resulting in True to hightlight,
'and False to not. (E.g. iif([field] = 3,True,False)) The hightlight will be where field = 3

'Add the below code (change txtHighLight to your box's name):

Private Sub Form_Open(ByRef intCancel As Integer)

Me.txtHighLight.FontSize = 24
Me.txtHighLight.FontName = "Terminal"
Me.txtHighLight.Format = ";" & Chr(34) & String(250, 219) & Chr(34)

End Sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom