Here is how I think you should use it:
Code:
Private Sub cmdEncryptNames_Click() 'Add to a button on a form
Dim db as Dao.Database
Dim rs as Dao.Rcordset
Dim sName as String, sEncryptedName as string
Set db=CurrentDb
Set rs=db.OpenRecordset("Temp",dbOpenDynaset,dbSeeChanges)
If rs.recordcount=0 then GoTo Exit_Encrypt
Do until rs.EOF
sName =rs("Names")
sEncryptedName =vcEncrypt(sName, 54321)
rs.Edit
rs("Names")=sEncryptedName
rs.Update
rs.moveNext
Loop
Exit_Encrypt:
rs.close
Set rs=Nothing
Set db=Nothing
End Sub
Public Function vcEncrypt(strIn As String, lngKEY As Long) As String
Dim strChr As String
Dim i As Integer
For i = 1 To Len(strIn)
strChr = strChr & CStr(Asc(Mid(strIn, i, 1)) Xor lngKEY)
Next i
vcEncrypt = strChr
End Function
Cheers,