I have implemented a procedure to cycle through text boxes on a report
and apply color formatting based on the name of the control.
Here is the code I used:
On Error Resume Next
Dim ctl As Control
Dim intBranchPosition As Integer
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If Mid(ctl.ControlName, 4, 3) = "Div" Or Mid(ctl.ControlName,
4, 3) = "Reg" Then
Select Case CDec(Left(ctl.Value, 5))
Case -4.99 To 0
ctl.BackColor = vbGreen
Case -7.99 To -5
ctl.BackColor = vbYellow
Case Is < -7.99
ctl.BackColor = vbRed
End Select
If ctl.BackColor = vbWhite Then
ctl.BackColor = vbGreen
End If
End If
End If
Next ctl
The above procedure works great except on a group of text boxes that I
have formatted to display the output on multiple lines. The control
source for the textbox would output something similar to the following:
Branch Name
-7.51%
How would I grab only the percent value so that I could format that
according to code I used above?
Thanks.
Jason