Link to home
Start Free TrialLog in
Avatar of NCSO
NCSO

asked on

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
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

If you need to have custom button captions, then msgbox will not work, and you'll need to use your own dialog form.
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
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"
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.
Avatar of NCSO
NCSO

ASKER

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"
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial