If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Applying a substitution code

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-07-12, 05:53
JLR JLR is offline
Registered User
 
Join Date: Sep 2003
Location: London, England
Posts: 46
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.
Reply With Quote
  #2 (permalink)  
Old 02-07-12, 06:50
Sinndho Sinndho is offline
Registered User
 
Join Date: Mar 2009
Posts: 3,446
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!
Reply With Quote
  #3 (permalink)  
Old 02-07-12, 07:01
JLR JLR is offline
Registered User
 
Join Date: Sep 2003
Location: London, England
Posts: 46
Applying a substitution code

That's brilliant; thank you, Sinndho.
Reply With Quote
  #4 (permalink)  
Old 02-07-12, 07:04
Sinndho Sinndho is offline
Registered User
 
Join Date: Mar 2009
Posts: 3,446
You're welcome!
__________________
Have a nice day!
Reply With Quote
  #5 (permalink)  
Old 02-08-12, 07:46
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
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 my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On