• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:

Message box or Dialog, which to use

Hi experts,

I have a form that has multiple buttons, I need to ask the user a question, "Edit Mode or Add Mode", when the button is clicked.  Dependant on the users selection, will determine which form is opened.  What is the best way to accomplish this?  Examples please.

Thanx
0
NCSO
Asked:
NCSO
1 Solution
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
If you need to have custom button captions, then msgbox will not work, and you'll need to use your own dialog form.
0
 
Harisha M GCommented:
Hi, try this:

Select Case MsgBox("Click Yes for Edit Mode, No for Add Mode or Cance to Cancel the action",vbYesNoCancel)
    Case vbYes:
        'Perform Edit Mode
    Case vbNo:
        'Perform Add Mode
    Case Else:
        'Do something else or nothing
End Select

---
Harish
0
 
GrahamSkanCommented:
You would need to rephrase the question and if you want to use MsgBox.

e.g. "Click 'Yes' for Edit mode and 'No' for Add Mode"
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jmundsackCommented:
I am not trying to be a jerk here, but I think that Harish's suggestion is very counter-intuitive.  If you're going to have Yes or No buttons, the message box should be asking a Yes or No question.  Having to translate what Yes and No truly represent would be very tedious.  Just something to consider.
0
 
NCSOAuthor Commented:
I truly just wanted, when the user clicks an object that some type of visual control asks if they want to "Add a New Record" or "Edit and Existing Record"
0
 
Carl TawnSystems and Integration DeveloperCommented:
If they're two seperate questions then a MsgBox will do fine:


    Private Sub cmdEdit_Click()
        If MsgBox("Edit record ?", vbYesNo) = vbYes Then
            '// Code to edit the record
        End If
    End If

    Private Sub cmdAdd_Click()
        If MsgBox("Add an new record ?", vbYesNo) = vbYes Then
            '// Code to edit the record
        End If
    End If
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now