Solved

How to mask a number by using vbscript

Posted on 2006-10-25
5
526 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
Comment Utility
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
Comment Utility
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
Comment Utility

Thanks so very much for all your great help!

It works perfectly :))

0
 
LVL 13

Expert Comment

by:jmundsack
Comment Utility
Sorry angelIII, I wasn't trying to tap your points.
0
 
LVL 142

Expert Comment

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

744 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

17 Experts available now in Live!

Get 1:1 Help Now