Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 5th, 2005, 04:06 PM
Registered User
 
Join Date: Dec 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ben805
Default Number Validation

Hello,

I have this Access 2000 VBA function, can anyone tell me what it does to these numbers?? and how can i create numbers that will result to true in the function.

001574950471 001574950455 001574950463 001574950448 001574950422


Public Function ValidateAccessCard(ByRef strAccessCard As String) As Boolean

    Dim intChecksum As Integer
    Dim intCounter As Integer
    Dim intSum As Integer
    Dim intWeight As Integer

    intWeight = 2
    intSum = 0
    intChecksum = Right(strAccessCard, 1)
    strAccessCard = Left(Right(String(12, "0") + strAccessCard, 12), 11)

    For intCounter = Len(strAccessCard) To 1 Step -1

    intSum = CDbl(intSum) + Int((CDbl(intWeight) * Val(Mid(strAccessCard,intCounter, 1))) / CDbl(10)) + CDbl(CLng(CDbl(intWeight) * Val(Mid(strAccessCard,intCounter, 1))) Mod 10)

    intWeight = -intWeight + 3

    Next intCounter

    ValidateAccessCard = ((10 - (intSum Mod 10)) Mod 10) = intChecksum

End Function






Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation For Phone Number and Mobile Number dhruthi.ram99 Javascript How-To 12 October 30th, 2011 07:24 AM
Mobile number Validation dharmeshtandel C# 2 April 23rd, 2008 01:12 PM
phone number validation debjanib ASP.NET 1.0 and 1.1 Professional 0 June 6th, 2006 12:01 PM
Number validation jmss66 Classic ASP Basics 2 March 2nd, 2005 11:48 AM
Phone Number validation help. mar0364 Classic ASP Basics 1 July 25th, 2004 06:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.