MackMan
Registered User.
- Local time
- Today, 23:25
- Joined
- Nov 25, 2014
- Messages
- 174
Hi all.
In order to hide some sensitive data, specifically around account numbers etc, I'm trying to replace the first half of the text within a textbox with asterisks.
example; turning AG7465LFR721 into ******LFR721
In this instance Account numbers are various lengths (including text) and need to replace half of the strings with *'s to users who do not need to know this.
Len Counts the number of characters.
If it's even I divide by two. If it's odd, I divide by 2, then add 1.
This gives me the number of characters to replace, but despite looking here and google (all search results show how to search using *'s and hide all text with * (like password entry) I'm failing on vba's replace function.
Is this even possible at data entry point, or will I need to create an unbound text box, then pass with values to the bound text box using after update?
I understand the syntax of the replace function
but fail to see how I could implement this without lengthy code to count each character in turn (find), then replace it with an asterisk (replace)...
Or if it's possible, I'm totally going about it the wrong way... and there is a really simple solution I'm not looking at?
any help to point me in the right direction would be greatly appreciated.
I'm not looking for code how it can be done, but a "gentle" nudge in the right direction so I can learn, if there's an easier solution.
In order to hide some sensitive data, specifically around account numbers etc, I'm trying to replace the first half of the text within a textbox with asterisks.
example; turning AG7465LFR721 into ******LFR721
In this instance Account numbers are various lengths (including text) and need to replace half of the strings with *'s to users who do not need to know this.
Len Counts the number of characters.
If it's even I divide by two. If it's odd, I divide by 2, then add 1.
This gives me the number of characters to replace, but despite looking here and google (all search results show how to search using *'s and hide all text with * (like password entry) I'm failing on vba's replace function.
Is this even possible at data entry point, or will I need to create an unbound text box, then pass with values to the bound text box using after update?
I understand the syntax of the replace function
Code:
Replace ( string1, find, replacement, [start, [count, [compare]]] )
Or if it's possible, I'm totally going about it the wrong way... and there is a really simple solution I'm not looking at?
any help to point me in the right direction would be greatly appreciated.
I'm not looking for code how it can be done, but a "gentle" nudge in the right direction so I can learn, if there's an easier solution.