Results 1 to 8 of 8

Thread: msgbox vbYesNo

  1. #1
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557

    Unanswered: msgbox vbYesNo

    Okay I know this is probably a completely simple question. I want a message box to come up saying "Are you sure you want to print this 77 page report". I want it if they click no to not print the report. I can do this creating my own custom form, but I dont know how to do it using the msgbox function with vbYesNo or vbOKCancel or one of those.

    Any help is much appreciated.

    Thanks,
    JS
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: msgbox vbYesNo

    Originally posted by JSThePatriot
    Okay I know this is probably a completely simple question. I want a message box to come up saying "Are you sure you want to print this 77 page report". I want it if they click no to not print the report. I can do this creating my own custom form, but I dont know how to do it using the msgbox function with vbYesNo or vbOKCancel or one of those.

    Any help is much appreciated.

    Thanks,
    JS
    Dim MsgResult as vbMsgboxResult

    MsgResult=Msgbox("Question",vbYesNo,"Title")
    if MsgResult <> vbYes then Exit from wherever ...

  3. #3
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557
    I knew it was simple Thanks a bunch!

    JS
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    A msgbox set to vbYesNo will return values of either vbYes, or vbNo that you can evaluate in an if statement:

    If MsgBox("Are you sure you want to print this 77 page report") = vbYes Then
    doCmd.PrintReport
    Else
    Msgbox "Report cancelled"
    End if

  5. #5
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Man, beaten by a full 3 minutes. hah.

  6. #6
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by Teddy
    Man, beaten by a full 3 minutes. hah.
    Ah yes ... But you flesh out an answer more fully whereas I just answer the question ... If someone needs an example they have but to ask ...

    - Mike

  7. #7
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557

    LOL Teddy

    LOL Guys thanks for the help I appreciate both answers now my knowledge of VBA has expanded a bit more.

    You guys are a great help.
    JS
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

  8. #8
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    darn beaten by a full 10 mins...

Posting Permissions

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