Re: Product Key
- From: "Ken Snell \(MVP\)" <kthsneisllis9@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 8 May 2007 11:21:35 -0400
The functions won't do creation and translation of a specific key; you'd
need to write other programming to do that. I posted these functions in
response to my understanding that you were asking how to limit the randomly
chosen characters to a specific set of characters.
--
Ken Snell
<MS ACCESS MVP>
"Axis" <Axis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5C8F8982-0D47-47B1-B13D-982FDC33AA6E@xxxxxxxxxxxxxxxx
Thanks for you reply.
I have looked at the code below and I can't quite work out from the
example
how I would use it to translate a string into a key. The same string has
to
be translated into the same key each time, possibly with the use of a
coding
string or number.
"Ken Snell (MVP)" wrote:
Here are two functions that I often use as a "group" for these types of
purposes. Just list all the characters that are valid in the Select Case
part of the second function:
Public Function GetARandomCharacter() As String
Dim xlngAsciiNum As Long
On Error Resume Next
Randomize
Do
xlngAsciiNum = Int((256 * Rnd) + 1)
If IsAValidRandomCharacter(xlngAsciiNum) = True Then
GetARandomCharacter = Chr(xlngAsciiNum)
Exit Do
End If
Loop
Exit Function
End Function
Private Function IsAValidRandomCharacter(xlngAsciiNumber As Long) As
Boolean
On Error Resume Next
Select Case xlngAsciiNumber
Case Asc("a") To Asc("z"), Asc("A") To Asc("Z"), _
Asc("0") To Asc("9")
IsAValidCharacter = True
Case Else
IsAValidCharacter = False
End Select
Exit Function
End Function
--
Ken Snell
<MS ACCESS MVP>
"Axis" <Axis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E3A80061-3930-4261-AC59-B399816F181F@xxxxxxxxxxxxxxxx
I want to produce a product key based upon the Product name, a purchase
date
and one or two other fields, that is provided to the user to register
their
database. I have code for encryting passwords but that produces a lot
of
characters that are not keyable. I need to find an algorithm that
restricts
the coded information to alphanumeric.
Does anyone have any examples of this.
.
- Follow-Ups:
- Re: Product Key
- From: Axis
- Re: Product Key
- References:
- Re: Product Key
- From: Ken Snell \(MVP\)
- Re: Product Key
- From: Axis
- Re: Product Key
- Prev by Date: RE: Object required error
- Next by Date: Re: Show Query Design Grid via VBA
- Previous by thread: Re: Product Key
- Next by thread: Re: Product Key
- Index(es):
Relevant Pages
|