Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-18-2019, 11:29 PM   #1
scallebe
Newly Registered User
 
Join Date: Mar 2018
Posts: 51
Thanks: 29
Thanked 1 Time in 1 Post
scallebe is on a distinguished road
Chow password gives me a strange result

Good morning specialists,

I find a code on the web to show or hide the password in my Loginform.

Code:
Private Sub lbl_Click()
If Me.lbl.Caption = "Show Password" Then
Me.UserPassword.InputMask = True
Me.lbl.Caption = "Hide Password"
UserPassword.SetFocus
Else
Me.UserPassword.InputMask = "Password"
Me.lbl.Caption = "Show Password"
UserPassword.SetFocus
End If
End Sub
It works perfect but in my case my password = "3"

When I click the togglebutton the "*" schanges in W3r instead of 3

Once my password is longer e.g. 333 then it shows 333.

With 3 and 33 it shows W3r or W33r

Why is that?

Thanks

Greetz

Pascal

scallebe is offline   Reply With Quote
Old 09-19-2019, 12:09 AM   #2
CJ_London
Super Moderator
 
Join Date: Feb 2013
Location: UK
Posts: 11,333
Thanks: 40
Thanked 3,670 Times in 3,538 Posts
CJ_London is a glorious beacon of light CJ_London is a glorious beacon of light CJ_London is a glorious beacon of light CJ_London is a glorious beacon of light CJ_London is a glorious beacon of light
Re: Chow password gives me a strange result

the inputmask property is text - you are giving it a value of -1 (true)

the usual way to use remove the password mask is

Me.UserPassword.InputMask = ""
__________________
CJ_London
_______________________
A little thanks goes a long way. If you have found this post useful, please tick the thanks button
CJ_London is offline   Reply With Quote
The Following User Says Thank You to CJ_London For This Useful Post:
scallebe (09-19-2019)
Old 09-19-2019, 12:20 AM   #3
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,000
Thanks: 114
Thanked 3,012 Times in 2,739 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Chow password gives me a strange result

I don't get your result but the method isn't reliable.
Try typing longer password of more than four characters then click the button to hide the password. You will get an error

Either follow the advice by CJL or add a second textbox txtPassword of the same size and in the same position but with no input mask. Make this hidden by default

When you click the button or label (which needs a better name than 'lbl'), use code to show txtPassword and hide UserPassword or vice versa.

Whichever method you use, you should also ensure the cursor is moved to the start of the password using SelStart=0
This old post may help https://bytes.com/topic/access/answe...nput-mask-code

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin (Mendip Data Systems)
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


"As we know, there are known knowns; there are things we know we know. We also know there are known unknowns; that is to say we know there are some things we do not know. But there are also unknown unknowns – the ones we don't know we don't know. It is the latter category that tend to be the difficult ones" Donald Rumsfeld
isladogs is offline   Reply With Quote
The Following User Says Thank You to isladogs For This Useful Post:
scallebe (09-19-2019)
Old 09-19-2019, 02:44 AM   #4
scallebe
Newly Registered User
 
Join Date: Mar 2018
Posts: 51
Thanks: 29
Thanked 1 Time in 1 Post
scallebe is on a distinguished road
Re: Chow password gives me a strange result

#CJ LONDON, #isladogs

Thanks for reply,

Once my DB is ready, I'm gonna use a longer password. Now I use a short one because it's easyer as long as I'm in the design mode of the DB.

I used both advices….

Here's the final code :
Code:
Private Sub btSeePW_Click()
If Me.btSeePW.Caption = "Show Password" Then
Me.UserPassword.InputMask = ""
Me.btSeePW.Caption = "Hide Password"
UserPassword.SetFocus
Me.UserPassword.SelStart = 0
Else
Me.UserPassword.InputMask = "Password"
Me.btSeePW.Caption = "Show Password"
UserPassword.SetFocus
Me.UserPassword.SelStart = 0
End If
End Sub
Thanks a lot

Greetz

Pascal

scallebe is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Query produces strange result Rowey Queries 3 02-18-2019 01:54 PM
[SOLVED] strange filter result leanpilar Forms 4 04-10-2016 02:18 AM
Strange result from Query: Please help sparkyboy2406 Queries 15 02-24-2010 02:53 PM
Strange Result Luddite Lad Queries 3 05-01-2006 02:39 AM
Strange result when using the Resize code Sam Summers Forms 0 10-03-2003 10:48 AM




All times are GMT -8. The time now is 12:48 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World