Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2003
    Location
    London, England
    Posts
    52

    Unanswered: Applying a substitution code

    How would I write a query in Access that converted all the words in a table (which contains all the words of a dictionary and is called DICT) into their encoded form using a substitution code like this?

    [B U R S T Y D X E Q J P L W I M Z K G C N F H O A V] from [a b c d e f g h i j k l m n o p q r s t u v w x y z]

    Thus abcde should be encoded as BURST and ambidextrous should be encoded as BLUESTOCKING.
    I am a novice and I would be most grateful for a clear explanation.

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You could use this:
    Code:
    Function Substitute(ByVal Word As String) As String
    
        Const c_SubstString As String = "BURSTYDXEQJPLWIMZKGCNFHOAV"
        
        Dim i As Long
        
        For i = 1 To Len(Word)
            Substitute = Substitute & Mid(c_SubstString, Asc(UCase(Mid(Word, i, 1))) - 64, 1)
        Next i
        
    End Function
    Usage:
    Code:
    ? substitute("abcde")
    yields: "BURST"
    Have a nice day!

  3. #3
    Join Date
    Sep 2003
    Location
    London, England
    Posts
    52

    Applying a substitution code

    That's brilliant; thank you, Sinndho.

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    are you trying to encrypt your data, if so you'd be better off using the pre supplied encryption routines such as the Capicom dll from Microsoft. there are oither encryption schemes such as PGP. however when developing, especially whjen using MS Access you do need to be aware tha Access isn't the most secure platform and isnt' particularly lockout the most determined or knowledgeable attacker.

    Access can be relatively easily secured against casual (ab)users threough thngs like alwasy deploying as encrypted files .mde. applying a consistent appraoch to security but also reading, re reading and then reading the Secuirty FAQ for Access.

    things have chanegd since more recent versions of Access dropped workgroup files which were a big security breach but Ive not looke at applying security to rcent versions (IIRC 2007 on)
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •