?
Solved

How to mask a number by using vbscript

Posted on 2006-10-25
5
Medium Priority
?
581 Views
Last Modified: 2012-08-14
Hi,
I am outputting an account number, but for security reasons I would like to mask
all of the numbers except the last 4 digits.
For example: 123456789      -->        *****6789 or
                    121212127878 -->  ********7878 and so on.
 
Any ideas as to how to do this?

Thanks!
....
<table cellspacing="0" cellpadding="4" border="0" width="1144">
<tr>
<td width="80" align="left" style="border: 1 solid #2979b5"><p align="center">
      <font face="Arial" size="2">&nbsp;Account No</font></p></td>  
<tr>
       <td width="49" style="border: 1 solid #2979b5"><font face="Arial" size="2">&nbsp;<%=rs("AccountNo")%></font></td>

</tr>
<%rs.MoveNext
                     next%>
                             
</table>

0
Comment
Question by:avi4
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 1200 total points
ID: 17803524
there are 2 options in your case:
either do it already in the query, or indeed in the code.

<%=rs("AccountNo")%>

would be

<%=  space( len(rs("AccountNo") ) -4, "*" ) & right(rs("AccountNo"),4) %>
0
 
LVL 13

Accepted Solution

by:
jmundsack earned 800 total points
ID: 17805502
NO POINTS FOR ME PLEASE!

Angel--I think the function you meant was "String()" not "Space()"...

Instead of
    <%=  space( len(rs("AccountNo") ) -4, "*" ) & right(rs("AccountNo"),4) %>

Use
    <%=  String( len(rs("AccountNo") ) -4, "*" ) & right(rs("AccountNo"),4) %>

:)
0
 

Author Comment

by:avi4
ID: 17805963

Thanks so very much for all your great help!

It works perfectly :))

0
 
LVL 13

Expert Comment

by:jmundsack
ID: 17805980
Sorry angelIII, I wasn't trying to tap your points.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17806654
but you where right. I actually checked for the function name, saw string, but wrong space ...
good job
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month14 days, 14 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question