Snuggle Walrus
Member
- Local time
- Today, 03:46
- Joined
- May 14, 2020
- Messages
- 32
Hey all. I'm trying to write some code that checks if the % of a text box (formatted as a percentage with 2 decimal places) is at 100.00% but i cant seem to get it to work.
I've tried a few things which i'll list after my code
.
I've tried If VCurrentPercent = "100.00%", 1, 1.0 and 100 as well but none of these seem to work
what am i doing wrong
? Thanks have a lovely day!


- PercentChecker is the text box holding the % and is calculated based on the other percentages updating.
- This code is on an "After Update" for a box which affects the calculation of the Percent Checker
- The Red part seems to work but i'm unsure if my % check is working but at least it does change its colour from here so I know that it will once i get my code right hopefully change to green.
Code:
Dim VCurrentPercent As Integer
Dim VRed As Long
Dim VGreen As Long
On Error GoTo OPSYSError
VCurrentPercent = Me.PercentChecker
VGreen = RGB(0, 255, 0)
VRed = RGB(255, 0, 0)
If VCurrentPercent = 100.00 Then
Me.PercentChecker.ForeColor = VGreen
End If
If VCurrentPercent <> 100 Then
Me.PercentChecker.ForeColor = VRed
End If
I've tried If VCurrentPercent = "100.00%", 1, 1.0 and 100 as well but none of these seem to work

