I have tried to make my text box limited to only 1 decimal point with only two numbers after the decimal specifically for US currency.
My code is:
If (KeyAscii < 46 Or KeyAscii > 57) And KeyAscii <> 8 Or KeyAscii = 47 Then KeyAscii = 0
If txtPayRate.SelStart >= InStr(1, strText, ".") Then
If Len(Mid(strText, InStr(1, strText, ".") + 1)) > 0 Then
KeyAscii = 0
End If
End If
I can't figure out a way to make sure only one decimal is put in place followed by only two numbers after the decimal.
My code is:
If (KeyAscii < 46 Or KeyAscii > 57) And KeyAscii <> 8 Or KeyAscii = 47 Then KeyAscii = 0
If txtPayRate.SelStart >= InStr(1, strText, ".") Then
If Len(Mid(strText, InStr(1, strText, ".") + 1)) > 0 Then
KeyAscii = 0
End If
End If
I can't figure out a way to make sure only one decimal is put in place followed by only two numbers after the decimal.