how to mask a password text box in access 2007

shandoo27

Registered User.
Local time
Today, 07:42
Joined
May 20, 2010
Messages
30
Hi,

Is there a way to mask the password as the user types in the text box in MS access2007 using a suitable VBA code?? I want to print * for each character entered.

Is it possible? If so please guide me as to how it can be achieved.

Thanks for the help in advance.
 
Hey,
Thanks if anyone was going to help me with the above problem.

The problem has been resolved rather very easily.
Me.ActiveControl.InputMask="PASSWORD"

This masks the password textbox peacefully.
 
don't you hate that when you ask a question after spending hours trying to work it out and then you suddenly find it.

by the way if you save the password somewhere you might like to encrypt it before saving

Code:
Public Function XORDecryption(CodeKey As String, DataIn As String) As String
    
    Dim lonDataPtr As Long
    Dim strDataOut As String
    Dim intXOrValue1 As Integer
    Dim intXOrValue2 As Integer
    

    For lonDataPtr = 1 To (Len(DataIn) / 2)
        'The first value to be XOr-ed comes from the data to be encrypted
        intXOrValue1 = Val("&H" & (Mid$(DataIn, (2 * lonDataPtr) - 1, 2)))
        'The second value comes from the code key
        intXOrValue2 = Asc(Mid$(CodeKey, ((lonDataPtr Mod Len(CodeKey)) + 1), 1))
        
        strDataOut = strDataOut + Chr(intXOrValue1 Xor intXOrValue2)
    Next lonDataPtr
   XORDecryption = strDataOut
End Function


Public Function XOREncryption(CodeKey As String, DataIn As String) As String
    
    Dim lonDataPtr As Long
    Dim strDataOut As String
    Dim temp As Integer
    Dim tempstring As String
    Dim intXOrValue1 As Integer
    Dim intXOrValue2 As Integer
    

    For lonDataPtr = 1 To Len(DataIn)
        'The first value to be XOr-ed comes from the data to be encrypted
        intXOrValue1 = Asc(Mid$(DataIn, lonDataPtr, 1))
        'The second value comes from the code key
        intXOrValue2 = Asc(Mid$(CodeKey, ((lonDataPtr Mod Len(CodeKey)) + 1), 1))
        
        temp = (intXOrValue1 Xor intXOrValue2)
        tempstring = Hex(temp)
        If Len(tempstring) = 1 Then tempstring = "0" & tempstring
        
        strDataOut = strDataOut + tempstring
    Next lonDataPtr
   XOREncryption = strDataOut
End Function

pretty sure I got it from this forum.
 
You can also do this by selecting password for the input mask property of the textbox if you dont want to do it using code..
 

Users who are viewing this thread

Back
Top Bottom