Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    RegExp example for initial masking:
    Code:
    Dim re As RegExp
    Set re = CreateObject("vbscript.regexp")
    re.Pattern = "[a-zA-Z]"
    re.Global = True
    Debug.Print re.Replace("a'bc-d jh", "_ ")
    The added space used for clearer display will complicate replacing with guessed letter. Maybe use some other character such as ? without space.



    Replacing mask with selected character. Not seeing a RegExp solution that would be simpler.
    Code:
    Dim strW As String, strM As String, strL As String, x As Integer
    strW = "d'bc-d jh"
    strM = "?'??-? ??"
    strL = "d"
    For x = 1 To Len(strW)
        If Mid(strW, x, 1) = strL Then
            strM = Left(strM, x - 1) & strL & Mid(strM, x + 1)
        End If
    Next
    Debug.Print strM
    Last edited by June7; 08-03-2024 at 04:29 PM.
    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.

  2. #17
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    I was thinking that you could replace the original text with the same character plus a space?
    The the answer would be
    h u g h f e a r n l e y - w h i t t i n g s t a l l

    Then you put a label below the answer control, you could compare each character in each position. If they match put an * or a tick below the character.

    So we would then get

    Code:
    h u g h   f e a r n l e y  - w h i t t i n g s t a l  l 
       *        * *           *
    if we had keyed in u and e. Those could be entered into another control as e then u ? then if we keyed in i, we would get
    Code:
    h u g h   f e a r n l e y  - w h i t t i n g s t a l  l 
       *        * *           *            *    *
    The characters are not lining up despite code blocks?, but you should get the idea. An * would be below a correct character.

    Like this https://poki.com/en/g/hangman
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #18
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Micron, is your code supposed to replace dash with guessed letter?
    No, it's supposed to replace first name and last name with "-"; e.g. Mickey with ------ and Dolenz with ------ with a separating space in between first and last. Given that you have revealed a bit about your journey through life I thought you might relate to that name .
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 04-26-2020, 02:01 AM
  2. First game of the season
    By Bengtsson in forum Queries
    Replies: 5
    Last Post: 03-16-2020, 01:26 PM
  3. Math Game
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 12-26-2019, 05:34 PM
  4. Play Hangman in MSAccess
    By pkstormy in forum Code Repository
    Replies: 8
    Last Post: 12-26-2019, 04:23 PM
  5. Bingo Game
    By Gus in forum Access
    Replies: 0
    Last Post: 12-14-2008, 03:17 PM

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