Results 1 to 4 of 4

Thread: Msgbox function ? Question ?

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Location
    Nelspruit, RSA
    Posts
    8

    Post

    Im trying to run this code but when I click the Yes or No buttons nothing happens.

    If Me.Input = "UserInput" then
    Msgbox "Click Yes to Continue No to cancel", vbyesno
    If msgbox(vbyesno) = vbYes then
    Me.Input = "UserInput"
    Else
    If msgbox(vbyesno) = vbNo then
    Docmd.cancelevent
    end if
    end if
    end sub

    What I basically want to happen is that when a person clicks the Yes button a certain event occur and when he clicks No another event occur. At the moment I experiemented with the vbOKOnly and worked but not with vbYesNo, vbOKCancel etc.

    What the hec am I doing wrong here?

    Fouche

  2. #2
    Lively Member
    Join Date
    Oct 1999
    Location
    Australia
    Posts
    115

    Post

    Try this

    Code:
    if msgbox("your question", vbYesNo) = vbYes then
       ....
    else
       ....
    end if

  3. #3
    Member
    Join Date
    Jan 2000
    Location
    Singapore
    Posts
    59

    Post

    Hi
    You are using msgbox statement not the function. For your case you should use msgbox function.
    Here is some sample try this.

    Private Sub Command2_Click()
    Dim result
    result = MsgBox("Do You want to see the form", vbOKCancel, "message")
    If result = vbOK Then
    Unload Me
    Form2.Show
    Else
    Cancel = True
    End If

    End Sub


    Have a nice time


    ------------------
    With regards,
    Karun

  4. #4

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Location
    Nelspruit, RSA
    Posts
    8

    Post

    Originally posted by karunakaran:
    Hi
    You are using msgbox statement not the function. For your case you should use msgbox function.
    Here is some sample try this.

    Private Sub Command2_Click()
    Dim result
    result = MsgBox("Do You want to see the form", vbOKCancel, "message")
    If result = vbOK Then
    Unload Me
    Form2.Show
    Else
    Cancel = True
    End If

    End Sub


    Have a nice time


    Thanks

Posting Permissions

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



Click Here to Expand Forum to Full Width