Encrypt textbox (1 Viewer)

Ironis

Learning Member...
Local time
Yesterday, 20:56
Joined
Oct 10, 2002
Messages
61
Hey there

I want a textbox on a form, which encrypts itself when a certain user is using the DB.
The encrypted text is a vreditcard number, and I only want the last few numbers to be visible. I already figured out how I can 'detect' wich user is 'online,' But I don't know how top make text unreadable.

It's more or less the following thing.
creditcard number:
1234 5678 9012 3456 7890

I want some users to see it like this:
****-****-****-****-7890

How can I 'replace' text in a record with a *, without altering the data?

Plz help out, I only need the code to show as *'s, the rest, asigning the code to certain users, I already know...

Thanks in advance,

Dennis (Ironis :cool: )
 

Mile-O

Back once again...
Local time
Today, 00:56
Joined
Dec 10, 2002
Messages
11,316
As you want to reveal the last few numbers I would suggest using the On KeyPress Event of the textbox, ensuring that key presses are the ASCII equivalent of those numbers and turning them into two strings: one that will be displayed as *** and one that is stored internally.
 

Ironis

Learning Member...
Local time
Yesterday, 20:56
Joined
Oct 10, 2002
Messages
61
That could be useful for passwords, but the problem now is that I have read-only users, which aren't able to fill in data, but they can read all data. These users aren't allowed to see CC numbers.
All personell will have access to the DB, and eventually also the customers. These will be very restricted, but still, they might grab a computer where the system is opened, and I don;t want the chance anybody sees these numbers.
So the typing is onot the problem, but the reading of the data...
 

Mile-O

Back once again...
Local time
Today, 00:56
Joined
Dec 10, 2002
Messages
11,316
I had a quick play about and made this little piece of code which you can adapt to your own purposes (i.e. IF.ELSE.ENDIF) to evaluate the current user's permissions.

All it does is takes the value from the textbox as it loads and converts it to the **** format.

An extra variable in the background can keep track of the real information and this variable can be queried on, etc.

Dim intLength As Integer
Dim strEncoded As String
Dim intCounter As Integer

intLength = Len(txtCode)
For intCounter = 1 To intLength - 4
strEncoded = strEncoded + "*"
Next intCounter

strEncoded = strEncoded + Right(txtCode, 4)

txtEncoded = strEncoded
 

Users who are viewing this thread

Top Bottom