Attribute VB_Name = "CommonFunctions" Option Compare Database Function EncryptIt(strCodeword As String, strMessage As String, intAction As Integer) 'strCodeword is the encryption key that is used to scramble the message. 'strMessage is the actual message to be scrambled 'intAction must be 0 to encrypt or 1 to decrypt the message text. Dim strAlphabet As String Dim intMessageChar As Integer Dim intCodewordChar As Integer Dim intShiftAdjust As Integer Dim intHomeLocation As Integer 'strAlphabet = "0@1#2$3%4^5&6*7=8-9+AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz" strAlphabet = "0@1#2$3%4^5&6*7=8-9+ AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz" intCodewordChar = 1 For intMessageChar = 1 To Len(strMessage) If InStr(1, strAlphabet, Mid(strMessage, intMessageChar, 1), vbBinaryCompare) > 0 Then If InStr(1, strAlphabet, Mid(strCodeword, intCodewordChar, 1), vbBinaryCompare) > 0 Then intShiftAdjust = InStr(1, strAlphabet, Mid(strCodeword, intCodewordChar, 1), vbBinaryCompare) intHomeLocation = InStr(1, strAlphabet, Mid(strMessage, intMessageChar, 1), vbBinaryCompare) If intAction = 0 Then intShiftAdjust = intHomeLocation - intShiftAdjust If intAction = 1 Then intShiftAdjust = intHomeLocation + intShiftAdjust If intShiftAdjust > Len(strAlphabet) Then intShiftAdjust = intShiftAdjust - Len(strAlphabet) If intShiftAdjust < 1 Then intShiftAdjust = intShiftAdjust + Len(strAlphabet) Else intShiftAdjust = 1 End If EncryptIt = EncryptIt & Mid(strAlphabet, intShiftAdjust, 1) Else EncryptIt = EncryptIt & Mid(strMessage, intMessageChar, 1) End If If intCodewordChar > Len(strCodeword) Then intCodewordChar = 1 Else intCodewordChar = intCodewordChar + 1 Next intMessageChar End Function