I have another question with Access tonight (2 right in a row), I'm on a roll.
Is there a way to hide a portion of a data fields input...example I type in 9 Social Security Numbers into a text field. I only want the last 4 to be visible. Is it possible? I know you can password a whole field and ********* will appear, but I DO want the last 4 to show.
I'm thinking there isn't a way, but hey...I got to ask.
Hiding part of a text fields input
-
- 2StarLounger
- Posts: 170
- Joined: 05 Feb 2010, 18:04
- Location: Jacksonville, NC
Hiding part of a text fields input
If you can't convince them, confuse them - Harry S. Truman
Nannette
Nannette
-
- cheese lizard
- Posts: 6241
- Joined: 16 Jan 2010, 00:14
- Location: Sydney Australia
Re: Hiding part of a text fields input
I'm by no means an Access expert, but, why don't you have two fields next to each other: one 5 character field with password property, then a 4 character normal text field, then concatenate the two together and store in another field not shown on the form...
Cheers, Claude.
-
- Administrator
- Posts: 78535
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Hiding part of a text fields input
Claude's suggestion is the easiest workaround.
In the attached sample database, a more complicated approach is demonstrated; it may be more work than it's worth.
Two text boxes are used:
One is bound to the SSN field, and is usually hidden.
The other is a calculated control that displays something like *****1234 where 1234 are the last 4 digits of the SSN. This one is usually visible, but locked.
The text boxes have the same size and position.
Next to the text boxes is a command button "Edit". When the user clicks this button, the calculated text box is hidden and the bound text box shown.
In the After Update event of the bound text box, the calculated text box is shown again and the bound text box hidden.
The On Current event of the form shows the bound text box in a new record, and the calculated one in existing records.
In the attached sample database, a more complicated approach is demonstrated; it may be more work than it's worth.
Two text boxes are used:
One is bound to the SSN field, and is usually hidden.
The other is a calculated control that displays something like *****1234 where 1234 are the last 4 digits of the SSN. This one is usually visible, but locked.
The text boxes have the same size and position.
Next to the text boxes is a command button "Edit". When the user clicks this button, the calculated text box is hidden and the bound text box shown.
In the After Update event of the bound text box, the calculated text box is shown again and the bound text box hidden.
The On Current event of the form shows the bound text box in a new record, and the calculated one in existing records.
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- PlutoniumLounger
- Posts: 15641
- Joined: 24 Jan 2010, 23:23
- Location: brings.slot.perky
Re: Hiding part of a text fields input
Neat!HansV wrote:In the attached sample database,
And if I've done my sums right, only 17 lines of code.
He who plants a seed, plants life.
-
- 2StarLounger
- Posts: 170
- Joined: 05 Feb 2010, 18:04
- Location: Jacksonville, NC
Re: Hiding part of a text fields input
I will work with these recommendations today. Thank you again everyone, as the advice you give is "always sage"...
I so depend on you!
:)
I so depend on you!
:)
If you can't convince them, confuse them - Harry S. Truman
Nannette
Nannette
-
- 2StarLounger
- Posts: 170
- Joined: 05 Feb 2010, 18:04
- Location: Jacksonville, NC
Re: Hiding part of a text fields input
Hans your answer seemed to do the trick for the student in my class who needed the answer. He is now a logged in user at Eileens so he can start asking questions on his own. Your the best resource I can give to any student in any class that I instruct. You guys are great! We thank all of you for all your input and solving his question. He felt that it was an easy work around and not difficult at all. :)
If you can't convince them, confuse them - Harry S. Truman
Nannette
Nannette
-
- StarLounger
- Posts: 76
- Joined: 14 Jul 2010, 19:35
Re: Hiding part of a text fields input
I will happily admit that I am that student. Teachesms has introduced me to this site, and I will stay with it. Thanks for your help. The if statement forces a limit on the show was a very interesting idea. I must admit that was a very creative idea of limiting the string. That has opened my eyes to some other ideas I have. Thanks. I'm sure I will post alot more on here.
-
- StarLounger
- Posts: 76
- Joined: 14 Jul 2010, 19:35
Re: Hiding part of a text fields input
I have encountered a question relating to this previous topic I am hoping I could get answered. While this works for forms, I am trying to only show the last 4 in datasheets, reports, and/or queries. Can I use the same type of code to use this in those situations? I would like to allow a user to print a report with the last 4 of a SSN, hopefully keeping the input as a full 9 digit SSN.
-
- Administrator
- Posts: 78535
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Hiding part of a text fields input
You can't do this in a datasheet form or query. You could have two columns side by side, one with the full SSN and one with the display value.
You can do it in a continuous form, and if you wish you cna make a continuous form look like a datasheet.
A report isn't used for input, so you only need a text box that displays the last 4 digits, you don't need a text box that contains the full SSN there.
You can do it in a continuous form, and if you wish you cna make a continuous form look like a datasheet.
A report isn't used for input, so you only need a text box that displays the last 4 digits, you don't need a text box that contains the full SSN there.
Best wishes,
Hans
Hans
-
- StarLounger
- Posts: 76
- Joined: 14 Jul 2010, 19:35
Re: Hiding part of a text fields input
I'm not worried about input for the last 4. I am trying to set it up inside the dynamic report that we set up in this thread: http://eileenslounge.com/viewtopic.php?f=29&t=2931 so that the SSN field will report the last 4 if possible.
-
- Administrator
- Posts: 78535
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Hiding part of a text fields input
I'd create a query qryMain based on tblMain that returns all the fields from tblMain plus a calculated column that displays the last 4 digits of the SSN.
Then use qryMain instead of tblMain in the code from the other thread.
Then use qryMain instead of tblMain in the code from the other thread.
Best wishes,
Hans
Hans