Forum Discussion

Jesslee999's avatar
Jesslee999
Copper Contributor
Jan 23, 2022

access - using input mask

hey, really need some help in regard to input masks. 
I'm doing a stock database and in one of the fields, some rows have , / and numbers. Not every row has them and every time I try to add a comma or a number it will not let me and when I add it into the input field it goes in the exact spot on every row.
The instructions I was given for the particular field was 'Any characters or spaces can
be added, all in capitals'. I've looked everywhere for help and nothing helped. please help 

  • arnel_gp's avatar
    arnel_gp
    Steel Contributor

    Jesslee999 

    you can remove the Input mask and just add code to the Textbox's 

    Keypress Event:

    'arnelgp
    'will accept Any character and convert to uppercase
    '____________________
    '
    Private Sub firstName_KeyPress(KeyAscii As Integer)
        Dim i As Integer
        i = Asc(UCase(Chr(KeyAscii)))
        If KeyAscii = 8 Or KeyAscii >= 32 And KeyAscii <= 126 Then
            KeyAscii = i
        Else
            KeyAscii = 0
        End If
    End Sub

     

     

Resources