Advanced Conditional Formatting

Harris21

Registered User.
Local time
Today, 18:52
Joined
Feb 6, 2008
Messages
15
Hello, i was wondering if anyone could help me out,

I have a form on my database that I require some advanced Conditional Formatting on.

I require my Invoice approver Label & Invoice Approver Textbox to be faded or locked if the Request Type equals 'SSR'.

I have been able to change the colour of the text in the text box using conditional formatting, Expression Is [Request Type]='SSR'

But as of yet I am unable to change the colour of the label. :(

Any suggestions?
 
can you not directly change the colour of the label

label1.forecolor = etc

the problem is that you cannot directly find the label corresponding to a control from the control, although you can find the name of a control linked to a label

so you either need a careful naming convention, or you need to iterate all the labels until you find the one you are looking for

------
although doing it this way, its done with code, not with conditional formatting
 
Thanks for the quick responce,

So im going to have to look at code like... if request type is SSR then set Invoice Approver Label text colour to gray? But obviously in code! LOL! :D

Any ideas on the type of code required?
 
Simple Software Solutions

Assuming you are using a bound form then on the OnCurrent Event of your form place the following code

If Me.RequestType = "SSR" Then

Me.RequestTypeLabelName.ForeColor = Your Color

End If

However if you set your RequestType.Enabled to False then the Label should be disabled aslo.

CodeMaster::cool:
 
That worked mate thanks!! :D

But one problem, as you move through the records and you come across a request that isen't an SSR then the ForColor is still RED when it should be Black, do i need to add a Else?
 
Just added an Else and it works like a charm!! :D

Thanks for your help!!!!
 
Just one more thing, i've tryed to change the colour of a textbox border but it dosen't seem to be doing it... Any suggestions?

Sorry to be a pest!
 
Simple Software Solutions

Example
The following example uses the RGB function to set the BorderColor, BackColor, and ForeColor properties depending on the value of the txtPastDue text box. You can also use the QBColor function to set these properties. Putting the following code in the Form_Current( ) event sets the control display characteristics as soon as the user opens a form or moves to a new record.

Sub Form_Current()
Dim curAmntDue As Currency, lngBlack As Long
Dim lngRed As Long, lngYellow As Long, lngWhite As Long

If Not IsNull(Me!txtPastDue.Value) Then
curAmntDue = Me!txtPastDue.Value
Else
Exit Sub
End If
lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)
If curAmntDue > 100 Then
Me!txtPastDue.BorderColor = lngRed
Me!txtPastDue.ForeColor = lngRed
Me!txtPastDue.BackColor = lngYellow
Else
Me!txtPastDue.BorderColor = lngBlack
Me!txtPastDue.ForeColor = lngBlack
Me!txtPastDue.BackColor = lngWhite
End If
End Sub

If you ar struggling with any issues go to the properties window of a control and find the item you need help on then press F1. This was the result of doing that for your latest query.
 

Users who are viewing this thread

Back
Top Bottom