Results 1 to 3 of 3

Thread: Little help

  1. #1
    Join Date
    Feb 2013

    Unanswered: Little help

    I am a student and am trying to learn Access. I have an issue that I can not figure out. I am to enhance a preexisting hangman program inwhich I need to add the yes/no option to the end of the program in order to restart the game if the player looses. I know about what I need to do but can not figure out were the code needs to go. I think I have a good start but keep getting errors when I try to run it now. Can anyone give me a little help in the right direction?

    Private Sub cmdVerify_Click()

    ' Did the user win?
    If (Me.txtA.Value & Me.txtB.Value & Me.txtC.Value & _
    Me.txtD.Value & Me.txtE.Value & Me.txtF.Value) _
    = "Access" Then
    MsgBox "You won!", , "Hangman"
    Me.cmdVerify.Enabled = False

    ' User did not guess the correct letter.
    ' Find an available body part to display.
    If Me.imgLeftLeg.Visible = False Then
    Me.imgLeftLeg.Visible = True
    iCounter = iCounter + 1
    ElseIf Me.imgRightLeg.Visible = False Then
    Me.imgRightLeg.Visible = True
    iCounter = iCounter + 1
    ElseIf Me.imgBody.Visible = False Then
    Me.imgBody.Visible = True
    iCounter = iCounter + 1
    ElseIf Me.imgLeftArm.Visible = False Then
    Me.imgLeftArm.Visible = True
    iCounter = iCounter + 1
    ElseIf Me.imgRightArm.Visible = False Then
    Me.imgRightArm.Visible = True
    iCounter = iCounter + 1
    ElseIf Me.imgHead.Visible = False Then
    Me.imgHead.Visible = True
    iCounter = iCounter + 1
    End If
    ' Find out if the user has lost.
    This is were I am getting the issues
    If iCounter = 6 Then
    MsgBox "Sorry, you lost. Would you like to play again?", vbYesNo, "Hangman"
    I have the start correct but can not figure out where to go from here.
    Me.txtA.Enabled = False
    Me.txtB.Enabled = False
    Me.txtC.Enabled = False
    Me.txtD.Enabled = False
    Me.txtE.Enabled = False
    Me.txtF.Enabled = False
    MsgBox "You have " & 6 - iCounter & _
    " chances left!", , "Hangman"
    End If

    End If

    End Sub

  2. #2
    Join Date
    May 2003
    Provided Answers: 5
    where are you getting the errors? can you attach a sample - sounds like one of those things where it is easier to fix and you look at how it was done than to try to micro explain the solution.
    Dale Houston, TX

  3. #3
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    you are doing nothing with the result of the message box
    di expect soemthign like

    usrResponse =MsgBox "Sorry, you lost. Would you like to play again?", vbYesNo, "Hangman"
    if userresponse = vbyes then
    'id expect there to be a call to a function wuch as newgame()
    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