devxlogo

A Smart ID Generator

I wrote a unique error-proof number generator that greatly simplifies the checking of clients’ accountnumbers or other IDs used by your application. I use it in conjunction with the CheckForValid functions.For example, the CheckForValid returns True for number “203931.” The CheckFor Valid returns False fornumber “209331.”

 Function CheckForValid(Num As Long) _        As Boolean' Check for valid numberResult = Num Mod 13   If Result <> 0 Then        CheckForValid = False         ' if false then the number is wrongElse        CheckForValid = True        'if true the number is OKEnd IfEnd FunctionFunction Generate(Num As Long) As Long'Generates the successor of a valid 'numberIf CheckForValid(Num) Then        Generate = Num + 13        'if valid GenerateElse        Generate = -1        ' Otherwise return -1   End IfEnd Function

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  Five Early Architecture Decisions That Quietly Get Expensive

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.