Solved

How to mask a number by using vbscript

Posted on 2006-10-25
5
532 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
  • 2
  • 2
5 Comments
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 300 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 200 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 142

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now