473,545 Members | 2,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing the input mask with code

1 New Member
Access beginner,
Hi,
Im using code to unlock information so the user can change the information. I also need the input mask to change from "password" to "text", but im struggling with that specific part of the code.
Thanks
Theuns

Private Sub EmployeeCode_En ter()
Dim strInput As String, strMsg As String

strMsg = "'Action code'is password protected."
strInput = InputBox(prompt :=strMsg, _
Title:="Emplyee 'action code'")
If strInput = "CLR" Then
Me.EmployeeCode .Locked = False
'Me.EmployeeCod e.InputMask = text
'InputMask = password
Else
Me.EmployeeCode .Locked = True

End If
Aug 16 '07 #1
5 16938
missinglinq
3,532 Recognized Expert Specialist
The question that has to be asked is "Why?" If you feel it's important enough to require an input mask in one instance, why would you change that in another instance? At any rate, the simple fact is that you can't! Input masks can only be defined in Design View.

Also, when using most Input Masks (it doesn't really matter for Password) be sure in use code like this to assure that if the user clicks on the textbox the cursor will go to the beginning of the field. Otherwise the insert point will be wherever they clicked in, and they'll waste time redoing it!

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourTextBoxName_Click()
  2.    Me.YourTextBoxName.SelStart = 0
  3. End Sub
  4.  
If your Access default for Entering a Field is set to anything other than "Go to start of field," also use this

Expand|Select|Wrap|Line Numbers
  1.  Private Sub YourTextBoxName_GotFocus()
  2.   Me.YourTextBoxName.SelStart = 0
  3. End Sub
Welcome to TheScripts!

Linq ;0)>
Aug 16 '07 #2
ADezii
8,834 Recognized Expert Expert
Access beginner,
Hi,
Im using code to unlock information so the user can change the information. I also need the input mask to change from "password" to "text", but im struggling with that specific part of the code.
Thanks
Theuns

Private Sub EmployeeCode_En ter()
Dim strInput As String, strMsg As String

strMsg = "'Action code'is password protected."
strInput = InputBox(prompt :=strMsg, _
Title:="Emplyee 'action code'")
If strInput = "CLR" Then
Me.EmployeeCode .Locked = False
'Me.EmployeeCod e.InputMask = text
'InputMask = password
Else
Me.EmployeeCode .Locked = True

End If
You can programmaticall y change the Input Mask for a Control, but as indicated by missingling, why? If you insist, the logic wouold be something similar to:
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtTest_GotFocus()
  2.   If <some condition> = True Then
  3.     Me![txtTest].InputMask = "Password"
  4.   Else
  5.     Me![txtTest].InputMask = "000-00-0000"
  6.   End If
  7. End Sub
Aug 16 '07 #3
missinglinq
3,532 Recognized Expert Specialist
Didn't realize that, ADezii! Access Help doesn't mention this; what a surprise!

Linq ;0)>
Aug 16 '07 #4
ADezii
8,834 Recognized Expert Expert
Didn't realize that, ADezii! Access Help doesn't mention this; what a surprise!

Linq ;0)>
Like you stated earlier, it's something you wouldn't normally do with code, but there's always a first.
Aug 16 '07 #5
TomTheToolman
1 New Member
I know this is an ancient thread, but it points out something that novices and experts alike need to remember: don't ask WHY, just answer the question.

In this case, it is now more and more common to see a "show" checkbox (cell phones and desktops both) so you can see your password when no one is looking over your shoulder.

Here, the "beginner" is showing the "experts" something they could have used!

Tom the Toolman
Sep 30 '18 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
12695
by: dude | last post by:
hello how would i make an input mask that only makes the first letter a capitol one? i've been playing around and testing various masks, also tried the wizard, but i've had no luck. could anyone help, many thanks in advance.
1
6281
by: Miranda Evans | last post by:
In my application, a text box control resides in a form. The text box control is unbound, but--assuming all edits are passed when the user click a command button on the form--the contents of the text box control end up in a field in a table with a data type of Date/Time. Is it possible to set up a mask on this text box control such that if...
9
2934
by: Paul | last post by:
hi, is there an input mask i could use on a report to do the following: (1) if i enter "THISISATEST" on my form, i want the text box on my report to display: "T H I S I S A T E S T". (2) if i enter "THIS IS A TEST" on my form, i want the text box on my report to display: "T H I S I S A T E S T".
2
3704
by: johnp | last post by:
Hi, Our Tech department updated users to Office 2003 this week. Now the input mask in one of the applications is showing up as: (###) ###-### The input mask wizard works correctly when I redo the mask. But in form view, the mask appears reverts to the previous.
7
7033
by: F. Michael Miller | last post by:
I have a db with Access front end, sql back, linked tables. I need to be able to change input masks at the table level in code. Any ideas? Thanks!
3
3319
by: AA Arens | last post by:
When I want the first character of a field to be Uppercased, I need to make an input mask, like >L< followed by ??????? for example. But this mask creates ____ in an unfilled field, which I don't like. How to get the fist character uppercased without an input mask or without ____ (underscores). When I click with the mouse on an empty field,...
9
11482
by: msnews.microsoft.com | last post by:
Hello. How can I set input mask for TextBox? Or can I use for mask input some other control?
18
2898
JamesDC
by: JamesDC | last post by:
Hi, So I'm working with an Access 2002 database for waste managemnt. The person in my role before my put together the program before he left and now I'm in charge of it. After updating a few areas based on the requests of the employees using the database I have come accross a problem with how dates are stored. I have a form for the...
7
3486
desklamp
by: desklamp | last post by:
I'm a total Access newbie, please bear with me! Using Win2K/Access 2003. I'm trying to create a table in which I can store IP addresses and other information. According to Microsoft, there is no native way of converting an IP address to an integer/long number (which is much more efficient to index and search). After searching, I found a...
0
7496
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7428
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7685
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7941
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7452
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7784
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5071
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1916
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.