Results 1 to 15 of 15
  1. #1
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49

    Converting of a few words to the other


    hi everyone

    I have tow Textboxes on the form. Inside one sentence and the other is empty

    How can I turn up Specified word to another ?

    Something like the following code :

    Case "Apple" = Orange

    Case "Fish" = Cat


    Thank you so much

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    What are the rules for replacing one for the other?

    I don't see a sentence, just single word.

    Perhaps a table of the equivalents.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    How many "Cases" do you have? If only a few which don't change, you can hard code it.
    If it's a lot, you can have a table that has "Apple" in one column and "Orange" in another.
    Assuming that Apple is typed into the first textbox, do a DLookup to find the substitute word to put in the second textbox via the after_update event for the first textbox.

  4. #4
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49
    hi . please check this


    Click image for larger version. 

Name:	Untitled.png 
Views:	22 
Size:	25.8 KB 
ID:	31766

  5. #5
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49
    Quote Originally Posted by davegri View Post
    How many "Cases" do you have? If only a few which don't change, you can hard code it.
    If it's a lot, you can have a table that has "Apple" in one column and "Orange" in another.
    Assuming that Apple is typed into the first textbox, do a DLookup to find the substitute word to put in the second textbox via the after_update event for the first textbox.
    about 30 cases

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    I think will need VBA along with a table of equivalents or else hard-coded in the VBA procedure.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Hard code example-
    The on_Click event for the convert button:
    Code:
    text2 = Text1
    Text2 = Replace(Text2,"Fish","Cat")
    Text2 = Replace(Text2,"Apple","Orange")
    ...and so on
    Last edited by davegri; 12-22-2017 at 10:33 PM. Reason: more

  8. #8
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49
    Quote Originally Posted by davegri View Post
    Hard code example-
    The on_Click event for the convert button:
    Code:
    text2 = Text1
    Text2 = Replace(Text2,"Fish","Cat")
    Text2 = Replace(Text2,"Apple","Orange")
    ...and so on
    Unfortunately, it was not work . I think this method is for conversion only one

    if the character conversion module is available, it also suffices

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    @zozzz,
    Where does the data in the text box come from? Is it in a table?

    If English is not you native language, you can use google translate to
    a) write a description of what you are trying to in business terms (plain talk no database terms/jargon)
    b) translate result to English and post it.

    We need more info about your database and context to offer more focused responses.

    Good luck.

  10. #10
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49
    Quote Originally Posted by orange View Post
    @zozzz,
    Where does the data in the text box come from? Is it in a table?
    ...
    Good luck.
    No - unbound text box

  11. #11
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    zozz-v1.zip
    This replicates your form Text1 and Text2 and does the conversion exactly if you enter the same example data into text1. Code is same as in post #7

    If this doesn't meet your needs, explain further.

  12. #12
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49
    Thanks davegri


    how can I use this in "public function Module" ?

  13. #13
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    how can I use this in "public function Module" ?
    zozz-v2.zip
    Like this. Includes new UDF (user defined function) in a new code module.

  14. #14
    zozzz is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    49
    thankyou

  15. #15
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Glad to make you happy! Good luck with the rest of your project.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Converting Date in Words
    By sanbhau in forum Programming
    Replies: 2
    Last Post: 04-21-2016, 05:37 AM
  2. How To add Words
    By aamer in forum Access
    Replies: 7
    Last Post: 11-19-2015, 06:55 AM
  3. converting number into words in query
    By joshynaresh in forum Queries
    Replies: 3
    Last Post: 04-02-2014, 08:17 PM
  4. converting number into words
    By joshynaresh in forum Forms
    Replies: 16
    Last Post: 02-28-2014, 12:29 AM
  5. Numbers To Words
    By Derrick T. Davidson in forum Reports
    Replies: 19
    Last Post: 03-20-2013, 02:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums