Sorry that was only a mistake in the post
Ok i have rename the module to module
and i still have the same error when runing the query and when i click ok ok
it highlight the (
This is the SQL view of the code
And when i try to decrypte i get the error enter paramter value. But that
maybe because i did not encrypt it yet
Could you maybe make a little sample data base and email to me where is
perfectly workin on your side
I
:
I don't see anything wrong with the code. I know it works, I have been using
it for about 5 or 6 years, starting in Access 97. The only thing I see is
you have this in 2 times:
EncryptCode = strValue
End Function
EncryptCode = strValue
End Function
Was that an error in the post, or is it in your module? Also, I don't know
what effect it has, but it is my understanding you should not name a module
and a procedure the same name.
It does not have to be an update query, the same holds true for an append
query.
Have you tried running it from the immediate window to see what results you
get there. Perhaps it is a problem with the syntax in the query.
:
Hi It does not work
I did the folowing i create a new module called EncryptCode and iserted the
following into it
Public Function EncryptCode(iToDo As Integer, strPass As String, _
Optional iSeed As Integer) As String
Dim strValue As String
Dim lngMxx As Long
Dim lngPlace As Long
iSeed = IIf(iSeed = 0, 105, iSeed + 95)
For lngMxx = 1 To Len(strPass)
If iToDo = 1 Then
' encode
lngPlace = (Asc(Mid(strPass, lngMxx, 1)) + 2550 + iSeed - lngMxx)
Mod 255
Else
' decode
lngPlace = 255 - (Abs((Asc(Mid(strPass, lngMxx, 1)) - 2550 -
iSeed + lngMxx) Mod 255))
End If
strValue = strValue + Chr(lngPlace)
Next
EncryptCode = strValue
End Function
EncryptCode = strValue
End Function
Created a update query with the temp table called Temp_Pin_number added the
field thats needs updating called Pin_Number with the update to Pin:
EncryptCode(1, StrPinCodeVariable) when save it i get the error
The expression you entered has an invalid . (dot) or ! operator or invalid
parentheses.
You may have entered an invalid identifier or typed parentheses following
the Null constant.
Could you tell me what i did wrong.
Why does it have to be a update query should it not be a append query since
i want to encrypte it from the temp table into the correct table or do i have
to do a update first and then append it to the main pin table.
Regards
Markus
:
Here is a function you can use to encrypt one value(field or variable).
The first argument (iToDo) tells the function to encrypt or decrypt the
string passed.
1 = encrypt - 2 = decrypt
The second argument(strPass) is the string you want either encrypted or
decrypted. If you pass it 2 and an encrypted string, it will return the plain
text version. If you pass it 1 and a plain text string, it will return the
string encrypted. Ignore the third argument, you really don't need it.
Public Function EncryptCode(iToDo As Integer, strPass As String, _
Optional iSeed As Integer) As String
Dim strValue As String
Dim lngMxx As Long
Dim lngPlace As Long
iSeed = IIf(iSeed = 0, 105, iSeed + 95)
For lngMxx = 1 To Len(strPass)
If iToDo = 1 Then
' encode
lngPlace = (Asc(Mid(strPass, lngMxx, 1)) + 2550 + iSeed - lngMxx)
Mod 255
Else
' decode
lngPlace = 255 - (Abs((Asc(Mid(strPass, lngMxx, 1)) - 2550 -
iSeed + lngMxx) Mod 255))
End If
strValue = strValue + Chr(lngPlace)
Next
EncryptCode = strValue
End Function
*************
Now, for using it in a query:
Where you would normally put the field name to retrieve the data from the
table, you need to make it an expression:
Normal for say [MyPinField]
Pin: EncryptCode(2, [MyTableName]![MyPinField]
To put it into the table using a query do the same thing except put it in
the Update To row for the field you want to encrypt:
Pin: EncryptCode(1, StrPinCodeVariable)
I prefer Merlot
:
Hallo
I hope some one can help me im not a good access VB expert i have found this
sample DB that uses AES encrypt but i need to change it a little to do what i
need but i don't know how. I'm sure for a VB expert it should take not more
then a few minutes to change it I will gladly send the person a bottle of win
if you can send me a working sample.
The sample files can be found here
http://www.rogersaccesslibrary.com/Otherdownload.asp?SampleName='AES Encryption.zip'
What i need it encrypt not just one field at a time. I have a table with
calling cards and there pin number so what i want is to tell it take a temp
table encrypt it into a different table but only the pin number column needs
to be encrypted. Now the other thing i need is a different DB i have a query
that reads the encrypted Pins and now i needs to decrypt them into a temp
table so they can be printed.
The encrypt key needs to be part of the code but so that i can change it
If some one could do this for me i would be very grate full. And really i
will post you a nice bottle of German wine to as a token.
Regards
Markus
Ps if you have any question you can email me at (e-mail address removed)