Mile-O-Phile said:
Try this idea to get around it - I used toggle buttons.
That works great ! I need to use that code for the other two fields. Do I just paste that code in 2 more times?
example
Private Sub tglE1_Click()
Call CorrectCodes(Me.tglE1)
End Sub
Private Sub tglH1_Click()
Call CorrectCodes(Me.tglH1)
End Sub
Private Sub tglM1_Click()
Call CorrectCodes(Me.tglM1)
End Sub
Private Sub tglW1_Click()
Call CorrectCodes(Me.tglW1)
End Sub
Sub CorrectCodes(ByVal tglCode As ToggleButton)
If tglCode = True Then
Me.txtResult1 = Me.txtResult1 & tglCode.Caption
Else
Dim intCounter As Integer
For intCounter = 1 To Len(Me.txtResult1)
If Mid(Me.txtResult1, intCounter, 1) = tglCode.Caption Then
Me.txtResult1 = Left(Me.txtResult1, intCounter - 1) & Mid(Me.txtResult1, intCounter + 1)
Exit For
End If
Next intCounter
End If
End Sub
Private Sub tglE
2_Click()
Call CorrectCodes(Me.tglE
2)
End Sub
Private Sub tglH
2_Click()
Call CorrectCodes(Me.tglH
2)
End Sub
Private Sub tglM
2_Click()
Call CorrectCodes(Me.tglM
2)
End Sub
Private Sub tglW
2_Click()
Call CorrectCodes(Me.tglW
2)
End Sub
Sub CorrectCodes(ByVal tglCode As ToggleButton)
If tglCode = True Then
Me.txtResult
2 = Me.txtResult
2 & tglCode.Caption
Else
Dim intCounter As Integer
For intCounter = 1 To Len(Me.txtResult
2)
If Mid(Me.txtResult
2, intCounter, 1) = tglCode.Caption Then
Me.txtResult
2 = Left(Me.txtResult
2, intCounter - 1) & Mid(Me.txtResult
2, intCounter + 1)
Exit For
End If
Next intCounter
End If
End Sub