Hello I am trying to change the color of part of a string that is in a text box in a form.
Note: This data is extracted from a SQL server so I cannot manipulate the data such as misplace the value in the text box.
ID MI 1234567891230 123456789123
'if the values are the same then do nothing
If (txtID.Value = txtMI.Value) Then
'if the length of txtID does not equal length of txtMI and Length txtID=13 And the last string value of txtID=0 and the first 12 values of txtID=txtMI
ElseIf (Len(txtID.Value) <> Len(txtMI.Value)) And (Len(txtID.Value) = 13) And (Right(txtID.Value, 1) = 0) And (Left(txtID.Value, 12) = txtMI.Value) Then
'this gets the last value of txtID
lastZero = Right(txtID.Value, 1)
'I have tried to use this but error says object required, I believe because this is not associated with a text box
lastZero.ForeColor = vbRed
End If