Solved

How to mask a number by using vbscript

Posted on 2006-10-25
5
541 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

810 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