Solved Restrict copying text box data in access vba (1 Viewer)

Ashfaque

Student
Local time
Today, 19:40
Joined
Sep 6, 2004
Messages
894
Hi All,

I would like to know if we can protect user copying password (*******) from a text box on form?

Thanks in advance....

Ashfaque
 

June7

AWF VIP
Local time
Today, 06:10
Joined
Mar 9, 2014
Messages
5,470
Are you concerned that a user will walk away from a login procedure after just entering their password?

Set textbox InputMask property to Password. Can't copy from the textbox. At least, that's what happened in my test. Will not copy to Windows clipboard.
 

Ashfaque

Student
Local time
Today, 19:40
Joined
Sep 6, 2004
Messages
894
my concern is when some authorities enters thier passwords in text box to approve something, (the textbox already set to InputMask property to Password ) can other user copy the **** password data by pressing cntrl C and paste some where or convert. THis is what I want to stop
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:10
Joined
Sep 21, 2011
Messages
14,270
Have you even tried?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:10
Joined
May 7, 2009
Messages
19,237
i made a simple Class to "re-mapped" the keyboard (actually not).
see form2.
see code-behind form2 on how to call the Class.
see the class.
 

Attachments

  • KeyRemapped.accdb
    696 KB · Views: 414

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:10
Joined
May 7, 2009
Messages
19,237
Set textbox InputMask property to Password. Can't copy from the textbox. At least, that's what happened in my test. Will not copy to Windows clipboard.
on my test, on immediate window, It Will Show:

?Forms!theFormName!theTextboxName
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:10
Joined
Sep 21, 2011
Messages
14,270
on my test, on immediate window, It Will Show:

?Forms!theFormName!theTextboxName
Well I just tried arnel's solution and it shows the same as his button? :unsure:
Do users have access to the immediate window in an accde?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:10
Joined
May 7, 2009
Messages
19,237
Well I just tried arnel's solution and it shows the same as his button?
did it show? show what, the real "text" (not the one displayed on the textbox).
i just test using:

?forms!form2!text0

it shows the "fake" text.
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:10
Joined
Sep 21, 2011
Messages
14,270
did it show? show what, the real "text" (not the one displayed on the textbox).
i just test using:

?forms!form2!text0

it shows the "fake" text.
Yes, fake text.
If I ?the control on one of mine it shows the actual pw

Sounds like OP is working with a bunch of hackers, who just want to break his DB :D

Plus it is not what he asked for this thread :(
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:10
Joined
May 7, 2009
Messages
19,237
Plus it is not what he asked for this thread
what did he asked?
the code i gave can hide the "true" text, thus prevent
others from copying (the real text).
the Title is "restrict" but the request on post#1 is to "protect".
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:10
Joined
Sep 21, 2011
Messages
14,270
He was initially just asking to prevent 'copy' of the control and any existing DB prevents that.?
You have now given him a way to hide even what was typed. (y)

He of course, could prevent access to the immediate window as an alternative?:unsure:
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 09:10
Joined
Feb 28, 2001
Messages
27,175
The REAL problem is the underlying issue of "how much security can one impose on an Access database?"

My thought would be to make this "extra approval" be a modal input box or modal pop-up sub-form that stores the input in a hidden field on the main form so there is nothing to copy once the person hits the ENTER key. OR... don't store the approval itself, store the fact that it was approved as a flag or some other method.
 

Ashfaque

Student
Local time
Today, 19:40
Joined
Sep 6, 2004
Messages
894
My general users dont have access to the expense approval form. Only managers and Operations Manager have access to this expense form.

The expense form has 2 fields at the end both are set to InputMask property to Password. So I just wanted to NO managers should copy Operations Manager password from last text box from approved expense form and past into other expense form which is not yet approved by Operations Manager.

I believe I clearly explained the problem.

Thanks in advance....
 

Ashfaque

Student
Local time
Today, 19:40
Joined
Sep 6, 2004
Messages
894
what did he asked?
the code i gave can hide the "true" text, thus prevent
others from copying (the real text).
the Title is "restrict" but the request on post#1 is to "protect".
Hi Arnel,

Your sample db recently placed at : https://www.access-programmers.co.uk/forums/threads/real-asterisk-password-hider.319370/
is giving * output when enter ZERO (0) and press reveal btn. Rest of the characters are perfect. But I asked for something else that I explained in post #13.

Appreciate your support.
 

Minty

AWF VIP
Local time
Today, 15:10
Joined
Jul 26, 2013
Messages
10,371
@Ashfaque As per at least 3 other posts, Have you actually tried to copy and paste the **** from the input mask?

If you can, you will find it simply copies a load of asterisk's - you have to use VBA to get the actual text value. If someone can do that then I suspect you have a bigger problem in securing your database.

In fact, as a test, I added the password mask to an existing form, I can't even copy the contents (not sure how that works, but it's clever).
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:10
Joined
May 7, 2009
Messages
19,237
I can't even copy the contents (not sure how that works, but it's clever).
you can't copy it in the clipboard, but in Immediate window or a Messagebox, it will show:

?[Forms]![FormName]![theTextbox]
 

isladogs

MVP / VIP
Local time
Today, 15:10
Joined
Jan 14, 2017
Messages
18,216
In general, 'key remapping' (actually encoding) isn't that secure as the output will be identical each time identical characters are entered.
For example entering AccessO as the password in @arnelgp's example gives output A;;9++O

NOTE: In @arnelgp's code the first character isn't remapped. Also the letter O (Chr79) is 'remapped' to itself

As a result, any user who is determined to hack passwords entered by others will probably be able to 'reverse engineer' the key remapping without too much effort
If this really a problem for the OP, I would suggest encrypting and salting the password entered rather than obfuscating it using 'key remapping'.
 
Last edited:

Minty

AWF VIP
Local time
Today, 15:10
Joined
Jul 26, 2013
Messages
10,371
my concern is when some authorities enters thier passwords in text box to approve something, (the textbox already set to InputMask property to Password ) can other user copy the **** password data by pressing cntrl C and paste some where or convert. THis is what I want to stop

@Ashfaque - Just to confirm your original question.
You can't do this, Access doesn't let you copy a password masked control. You don't need to do anything.
 

Users who are viewing this thread

Top Bottom