i'm building a data base program, using the data control. but the mask edit control isn't updated(only when i execute the program). so i'm trying transform the textbox for use these mask: "AA-AA-AA" (i belive the 'A' is for accept numbers and letters). but i don't get right results or i don't use the right event
can anyone advice me, please?

heres my actual code:
Code:
Private Sub Text1_Change()
    Text1.text = FormatText(Text1.text)
End Sub

Private Function FormatText(text As String) As String
    Dim i As Long
    Dim newstring As String
    For i = 1 To Len(text)
        newstring = newstring & Mid(text, i, 1)
        If IsMultiple(i, 2) = True And i + 1 <= Len(text) Then newstring = newstring & "-"
    Next
    FormatText = newstring
End Function

Function IsMultiple(ByVal Number As Integer, ByVal Multiple As Integer) As Boolean
    If Number Mod Multiple = 0 Then
        IsMultiple = True
    End If

    IsMultiple = False
End Function